--- os2sdk/demos/apps/setega/setega.c 2018/08/09 12:25:13 1.1.1.1 +++ os2sdk/demos/apps/setega/setega.c 2018/08/09 12:26:06 1.1.1.2 @@ -1,3 +1,5 @@ + /* Created by Microsoft Corp. 1987 + */ /*** SETEGA.C OS/2 demo program to switch EGA between 25- and 43- line modes * * SETEGA accepts one parameter, which must be either "25" or "43". @@ -11,25 +13,27 @@ * * 1) Check parameters * - * 2) Clear the screen, using the VIOSCROLLUP function as described + * 2) Clear the screen, using the VioScrollUp function as described * in the CLRSCR example elsewhere in these bulletin boards * - * 3) Get current mode information using VIOGETMODE + * 3) Get current mode information using VioGetMode * - * extern unsigned far pascal VIOGETMODE ( - * struct ModeData far *, - * unsigned ); + * USHORT APIENTRY VioGetMode ( + * PVIOMODEINFO, + * HVIO ); * * This call fills a data structure of type * - * struct ModeData { - * unsigned length; - * unsigned char type; - * unsigned char color; - * unsigned col; - * unsigned row; - * unsigned hres; - * unsigned vres; + * struct VIOMODEINFO { + * USHORT cb; + * UCHAR fbType; + * UCHAR color; + * USHORT col; + * USHORT row; + * USHORT hres; + * USHORT vres; + UCHAR fmt_ID; + UCHAR attrib; * }; * * whose address we pass in the first parameter. The second @@ -39,43 +43,45 @@ * of alphanumeric rows for this mode. This is changed to the * value specified in our parameter. * - * 5) VIOSETMODE is now used to set the mode. + * 5) VioSetMode is now used to set the mode. * - * extern unsigned far pascal VIOSETMODE ( - * struct ModeData far *, - * unsigned ); + * USHORT APIENTRY VioSetMode ( + * PVIOMODEINFO, + * HVIO ); * - * This call has the same parameters as VIOGETMODE. + * This call has the same parameters as VioGetMode. * We are now set to the desired mode. * * 6) We then set the cursor to an appropriate size and shape. This is * done by filling in a structure of the type * - * struct CursorData { - * unsigned cur_start; - * unsigned cur_end; - * unsigned cur_width; - * unsigned cur_attribute; + * struct VIOSURSORINFO { + * USHORT yStart; + * USHORT cEnd; + * USHORT cx; + * USHORT attr; * }; * - * with appropriate values, then calling VIOSETCURTYPE + * with appropriate values, then calling VioSetCurType * - * extern unsigned far pascal VIOSETCURTYPE ( - * struct CursorData far *, - * unsigned ); + * USHORT APIENTRY VioSetCurType ( + * PVIOCURSORINFO, + * HVIO ); * * where the second parameter is again the VIO handle, 0. * * 7) Last, we set the cursor to the upper left hand corner of the - * screen using VIOSETCURPOS. + * screen using VioSetCurPos. * * * Compile using the -Lp option; this program may be bound for use under * real mode. */ -#include -#include +#define INCL_SUB + +#include +#include #include void usage(); @@ -85,9 +91,9 @@ int argc; char *argv[]; { - struct ModeData modedata; + VIOMODEINFO modedata; - struct CursorData cursordata; + VIOCURSORINFO cursordata; static char buffer[2] = { 0x20, 0x07 }; /* scrolling fill character */ /* for clearing the screen */ @@ -96,31 +102,31 @@ char *argv[]; switch(atoi(argv[1])) { case 43: - VIOSCROLLUP( 0, 0, -1, -1, -1, (char far *)buffer, 0 ); - modedata.length = sizeof( modedata ); - VIOGETMODE( &modedata, 0 ); + VioScrollUp( 0, 0, -1, -1, -1, (char far *)buffer, 0 ); + modedata.cb = sizeof( modedata ); + VioGetMode( &modedata, 0 ); modedata.row = 43; - VIOSETMODE( &modedata, 0 ); - cursordata.cur_start = 7; - cursordata.cur_end = 7; - cursordata.cur_width = 1; - cursordata.cur_attribute = 0; - VIOSETCURTYPE( &cursordata, 0 ); - VIOSETCURPOS( 0, 0, 0 ); + VioSetMode( &modedata, 0 ); + cursordata.yStart = 7; + cursordata.cEnd = 7; + cursordata.cx = 1; + cursordata.attr = 0; + VioSetCurType( &cursordata, 0 ); + VioSetCurPos( 0, 0, 0 ); break; case 25: - VIOSCROLLUP( 0, 0, -1, -1, -1, (char far *)buffer, 0 ); - modedata.length = sizeof( modedata ); - VIOGETMODE( &modedata, 0 ); + VioScrollUp( 0, 0, -1, -1, -1, (char far *)buffer, 0 ); + modedata.cb = sizeof( modedata ); + VioGetMode( &modedata, 0 ); modedata.row = 25; - VIOSETMODE( &modedata, 0 ); - cursordata.cur_start = 12; - cursordata.cur_end = 13; - cursordata.cur_width = 1; - cursordata.cur_attribute = 0; - VIOSETCURTYPE( &cursordata, 0 ); - VIOSETCURPOS( 0, 0, 0 ); + VioSetMode( &modedata, 0 ); + cursordata.yStart = 12; + cursordata.cEnd = 13; + cursordata.cx = 1; + cursordata.attr = 0; + VioSetCurType( &cursordata, 0 ); + VioSetCurPos( 0, 0, 0 ); break; default: