Watcom C Library Reference : _scrolltextwindow, _searchenv, segread, _selectpalette, _setactivepage

 

 

 

 

_scrolltextwindow

 

Synopsis : #include <graph.h> 

              void _FAR _scrolltextwindow( short rows );

 


Description : The _scrolltextwindow function scrolls the lines in the current text window. A text window is defined with the _settextwindow function. By default, the text window is the entire screen.


The argument rows specifies the number of rows to scroll. A positive value means to scroll the text window up or towards the top of the screen. A negative value means to scroll the text window down or towards the bottom of the screen. Specifying a number of rows greater than the height of the text window is equivalent to clearing the text window with the _clearscreen function.


Two constants are defined that can be used with the _scrolltextwindow function:

  Constant  Meaning
 _GSCROLLUP  the contents of the text window are scrolled up (towards the top of the screen) by one row
 _GSCROLLDOWN  the contents of the text window are scrolled down (towards the bottom of the screen) by one row

 


Returns : The _scrolltextwindow function does not return a value.

 

 

See Also : _settextwindow, _clearscreen, _outtext, _outmem, _settextposition

 


Example :

#include <conio.h> 

#include <graph.h> 

#include <stdio.h>


void main( )

{
    int     i;

    char   buf[80];


    _setvideomode( _TEXTC80 );

    _settextwindow( 5, 20, 20, 40 );

    for( i = 1; i <= 10; ++i ) {
        sprintf( buf, "Line %d\n", i );

        _outtext ( buf );

    }


    getch( );

    _scrolltextwindow( _GSCROLLDOWN );

    getch( );

    _scrolltextwindow( _GSCROLLUP );

 

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

_searchenv

 

Synopsis : #include <stdlib.h> 

              void searchenv( const char *name, const char *env_var, char *buffer );

 


Description : The _searchenv function searches for the file specified by name in the list of directories assigned to the environment variable specified by env_var. Common values for env_var are PATH, LIB and INCLUDE.


The current directory is searched first to find the specified file. If the file is not found in the current directory, each of the directories specified by the environment variable is searched.

 

The full pathname is placed in the buffer pointed to by the argument buffer. If the specified file cannot be found, then buffer will contain an empty string.

 

 

Returns : The _searchenv function returns no value.

 

 

See Also : getenv, setenv, _splitpath, putenv

 


Example :

#include <stdio.h> 

#include <stdlib.h>


void display_help( FILE *fp )

{
    printf( "display_help T.B.I.\n" );

}

 


void main( )
{
    FILE   *help_file;

    char   full_path[_MAX_PATH];


    _searchenv( "watcomc.hlp", "PATH", full_path );

    if( full_path[0] == '\0' ) {
        printf( "Unable to find help file\n" );

    } else {
        help_file = fopen( full_path, "r" );

        display_help( help_file );

        fclose( help_file );

    }

}

 

Classification : WATCOM
Systems : All

 

 

 

 

 

 

 

segread

 

Synopsis : #include <i86.h> 

              void segread( struct SREGS *seg_regs );

 


Description : The segread function places the values of the segment registers into the structure located
by seg_regs.

 

 

Returns : No value is returned.

 

 

See Also : FP_OFF, FP_SEG, MK_FP

 


Example :

#include <stdio.h> 

#include <i86.h>


void main( )

{
    struct SREGS sregs;

 

    segread( &sregs );

    printf( "Current value of CS is %04X\n", sregs.cs );

}

 

Classification : WATCOM
Systems : All

 

 

 

 

 

 

 

_selectpalette

 

Synopsis : #include <graph.h> 

              short _FAR _selectpalette( short palnum );

 


Description : The _selectpalette function selects the palette indicated by the argument palnum from the color palettes available. This function is only supported by the video modes MRES4COLOR and _MRESNOCOLOR.


Mode _MRES4COLOR supports four palettes of four colors. In each palette, color 0, the background color, can be any of the 16 possible colors. The color values associated with the other three pixel values, (1, 2 and 3), are determined by the selected palette.


The following table outlines the available color palettes:

 Palette 
 Number
                                         Pixel Valuse
 1  2   3
 0  green  red  brown
 1  cyan  magenta  white
 2  light green  light red  yellow
 3  light cyan  light magenta  bright white

 

 

Returns : The _selectpalette function returns the number of the previously selected palette.

 

 

See Also : _setvideomode, _getvideoconfig



Example :

#include <conio.h> 

#include <graph.h>


void main( )

{
    int     x, y, pal;


    _setvideomode( _MRES4COLOR );

    for( y = 0; y < 2; ++y ) {

        for( x = 0; x < 2; ++x ) {
            _setcolor( x + 2 * y );

            _rectangle( _GFILLINTERIOR,

                          x * 160, y * 100,

                          ( x + 1 ) * 160, ( y + 1 ) * 100 );

        }

    }


    for( pal = 0; pal < 4; ++pal ) {
        _selectpalette( pal );

        getch( );

    }
    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

_setactivepage

 

Synopsis : #include <graph.h> 

              short _FAR _setactivepage( short pagenum );

 


Description : The _setactivepage function selects the page (in memory) to which graphics output is written. The page to be selected is given by the pagenum argument.


Only some combinations of video modes and hardware allow multiple pages of graphics to exist. When multiple pages are supported, the active page may differ from the visual page. The graphics information in the visual page determines what is displayed upon the screen. Animation may be accomplished by alternating the visual page. A graphics page can be constructed without affecting the screen by setting the active page to be different than the visual page.


The number of available video pages can be determined by using the _getvideoconfig function. The default video page is 0.

 

 

Returns : The _setactivepage function returns the number of the previous page when the active page is set successfully; otherwise, a negative number is returned.

 

 

See Also : _getactivepage, _setvisualpage, _getvisualpage, _getvideoconfig

 


Example :

#include <conio.h> 

#include <graph.h>


void main( )

{
    int     old_apage;

    int     old_vpage;


    _setvideomode( _HRES16COLOR );

    old_apage = _getactivepage( );

    old_vpage = _getvisualpage( );

 

    /* draw an ellipse on page 0 */

    _setactivepage( 0 );

    _setvisualpage( 0 );

    _ellipse( _GFILLINTERIOR, 100, 50, 540, 150 );

 

    /* draw a rectangle on page 1 */

    _setactivepage( 1 );

    _rectangle( _GFILLINTERIOR, 100, 50, 540, 150 );

    getch( );

 

    /* display page 1 */

    _setvisualpage( 1 );

    getch( );

 

    _setactivepage( old_apage );

    _setvisualpage( old_vpage ); 

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

 

 

This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).

 

WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)

 

 

 

728x90
반응형
Posted by 전화카드
,