--- os2sdk/demos/apps/sse/sse.c 2018/08/09 12:25:13 1.1.1.1 +++ os2sdk/demos/apps/sse/sse.c 2018/08/09 12:26:06 1.1.1.2 @@ -1,56 +1,51 @@ /*** SSE - Simple Screen Editor * - * - * - * - * - * - * - * + * Created by Microsoft Corp. 1987 */ +#define INCL_SUB +#define INCL_DOSFILEMGR +#define INCL_DOSSIGNALS - +#include +#include #include -#include -#include #include #include -#include #include "ssedefs.h" -unsigned short TotalLines; /* num of entries in line table */ +USHORT TotalLines; /* num of entries in line table */ struct Line far *LineTable[MAXLINES]; /* the line table */ -unsigned short TotalSegs; /* num of entries in seg table */ +USHORT TotalSegs; /* num of entries in seg table */ struct SegEntry SegTable[MAXSEGS]; char fbuffer[FBUFFSIZE]; -unsigned short bytesread; +USHORT bytesread; -unsigned char ScrBuff[LONGPAGE][LINESIZE]; -unsigned char EditBuff[LINESIZE]; -unsigned short EditBuffDirty; - -unsigned short PageSize; -unsigned short Mode43Set = 0; - -unsigned short ForeNorm = 0x07; -unsigned short BackNorm = 0x10; -unsigned short ForeHilite = 0x01; -unsigned short BackHilite = 0x70; -unsigned short Fore25 = 0x07; -unsigned short Back25 = 0x40; +UCHAR ScrBuff[LONGPAGE][LINESIZE]; +UCHAR EditBuff[LINESIZE]; +USHORT EditBuffDirty; + +USHORT PageSize; +USHORT Mode43Set = 0; + +USHORT ForeNorm = 0x07; +USHORT BackNorm = 0x10; +USHORT ForeHilite = 0x01; +USHORT BackHilite = 0x70; +USHORT Fore25 = 0x07; +USHORT Back25 = 0x40; -unsigned short CurRow, CurCol; -unsigned short TopRow; +USHORT CurRow, CurCol; +USHORT TopRow; -unsigned short LinesMarked, CharsMarked; -unsigned short MarkedLine[MAXLINES], MarkedChar[LINESIZE]; +USHORT LinesMarked, CharsMarked; +USHORT MarkedLine[MAXLINES], MarkedChar[LINESIZE]; char *fname; -unsigned short fhandle; +USHORT fhandle; /*** main * @@ -62,24 +57,24 @@ main(argc, argv) int argc; char *argv[]; { - unsigned short i; + USHORT i; - unsigned short handtype, flagword; + USHORT handtype, flagword; - struct ModeData modedata; /* from subcalls.h */ - struct CursorData cursordata; + VIOMODEINFO modedata; /* from bsesub.h */ + VIOCURSORINFO cursordata; /* check if we're in foreground */ - DOSQHANDTYPE( 0, (unsigned far *)&handtype, (unsigned far *)&flagword ); + DosQHandType( 0, &handtype, &flagword ); if( (handtype == 0) || ( !( flagword & 1 )) || ( !( flagword & 2 )) ) quit(1); /* disable signals so user can't exit with Ctrl-C or Ctrl-Break */ - DOSHOLDSIGNAL( TRUE ); + DosHoldSignal( TRUE ); /* initialize variables */ @@ -95,8 +90,8 @@ char *argv[]; /* Set PageSize to match the mode we're in, 25 or 43. This may be changed later by a switch from the command line. */ - modedata.length = sizeof( modedata ); - VIOGETMODE( &modedata, 0 ); + modedata.cb = sizeof( modedata ); + VioGetMode( &modedata, 0 ); if( modedata.row == 25 ) PageSize = SHORTPAGE; else PageSize = LONGPAGE; @@ -113,12 +108,12 @@ char *argv[]; ( argv[i][2] == '3' ) ) { PageSize = LONGPAGE; modedata.row = ( LONGPAGE + 1 ); - VIOSETMODE( &modedata, 0 ); - cursordata.cur_start = 6; - cursordata.cur_end = 7; - cursordata.cur_width = 1; - cursordata.cur_attribute = 0; - VIOSETCURTYPE( &cursordata, 0 ); + VioSetMode( &modedata, 0 ); + cursordata.yStart = 6; + cursordata.cEnd = 7; + cursordata.cx = 1; + cursordata.attr = 0; + VioSetCurType( &cursordata, 0 ); Mode43Set = 1; } else if( (argv[i][0] == '/') && @@ -180,7 +175,7 @@ char *argv[]; drawscr(0); name25(); - VIOSETCURPOS(0,0,0); + VioSetCurPos(0,0,0); getline( 0, &EditBuff[0] ); /* initialize */ dispatch(); freesegs(); @@ -190,24 +185,24 @@ char *argv[]; quit(n) /* if we set 43 line mode from command line, */ - unsigned short n; /* set it back to 25 line mode before exiting */ + USHORT n; /* set it back to 25 line mode before exiting */ { - struct ModeData modedata; - struct CursorData cursordata; + VIOMODEINFO modedata; + VIOCURSORINFO cursordata; if( Mode43Set ) { - modedata.length = sizeof( modedata ); - VIOGETMODE( &modedata, 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 ); + VioSetMode( &modedata, 0 ); + cursordata.yStart = 12; + cursordata.cEnd = 13; + cursordata.cx = 1; + cursordata.attr = 0; + VioSetCurType( &cursordata, 0 ); BackNorm = 0; ForeNorm = 0; clearscr(); } - DOSEXIT(1,n); /* exit with specified completion code */ + DosExit(EXIT_PROCESS,n); /* exit with specified completion code */ }