From ffd9ff27eb95dd8badaad891e88e884d40c79377 Mon Sep 17 00:00:00 2001 From: Maurilio Longo Date: Mon, 3 Apr 2000 21:44:40 +0000 Subject: [PATCH] 20000403-23:40 GMT+2 Maurilio Longo --- harbour/ChangeLog | 26 ++++--- harbour/source/rtl/gtos2/gtos2.c | 119 ++++++++++++++++++++++++------- 2 files changed, 109 insertions(+), 36 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 23ee6fb079..0396fd2926 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,10 +1,16 @@ +20000403-23:40 GMT+2 Maurilio Longo + + * source/rtl/gtos2/gtos2.c + ! Should work now and provide DispBegin() and DispEnd() support + ! statics are named following harbour naming conventions + 20000403-22:20 GMT+1 Victor Szakats * source/pp/stdalone/hbpp.c * source/compiler/cmdcheck.c * source/compiler/harbour.c * include/hbcomp.h - ! Fixed handling of the /D switch, it broke when introducing the + ! Fixed handling of the /D switch, it broke when introducing the multiple filenames at the command line feature. 20000403-21:08 GMT+1 Victor Szakats @@ -106,13 +112,13 @@ * source/vm/hvm.c ! hb_itemPutND(), hb_itemPutNLen(), hb_itemPutNDLen(), hb_vmNegate(), hb_vmPushDouble() - Fixed handling of double number widths. Negative numbers taken into + Fixed handling of double number widths. Negative numbers taken into account. Limits fixed. Checked against CA-Cl*pper. + hb_vmPushLongConst() added to push a long constant (pcode) long value. + hb_vmPushDoubleConst() added to push a constant (pcode) double value. * hb_vmPushDouble() restored to previous version. ! hb_vmPushDoubleConst() fixed to count the width of the double just like - CA-Cl*pper, note that this is an ugly hack, and as a next step the + CA-Cl*pper, note that this is an ugly hack, and as a next step the HB_P_PUSHDOUBLE pcode should be modified to fix this. ( !! TODO !! ) ; After these the decimal handling seems to be completely CA-Cl*pper compatible, the failing tests are due to floating point precision @@ -151,21 +157,21 @@ * include/hbapilng.h * include/hbvmpub.h * source/rdd/dbf1.c - * source/rtl/gtdos/gtdos.c - * source/rtl/gtsln/gtsln.c + * source/rtl/gtdos/gtdos.c + * source/rtl/gtsln/gtsln.c * source/rtl/tget.prg - * source/tools/asciisum.c - * source/tools/strasint.c + * source/tools/asciisum.c + * source/tools/strasint.c * source/tools/stringsx.c * source/tools/nconvert.prg - * source/vm/hvm.c + * source/vm/hvm.c * source/vm/macro.c - * source/vm/memvars.c + * source/vm/memvars.c * tests/memvar.prg * tests/testwarn.prg * tests/tstmacro.prg ! Tabs converted to spaces. - Please don't use tabs in the sources, because the formatting may be + Please don't use tabs in the sources, because the formatting may be much different when using another editor. * source/tools/Makefile diff --git a/harbour/source/rtl/gtos2/gtos2.c b/harbour/source/rtl/gtos2/gtos2.c index 1f140ab31a..05b3ab0584 100644 --- a/harbour/source/rtl/gtos2/gtos2.c +++ b/harbour/source/rtl/gtos2/gtos2.c @@ -61,7 +61,7 @@ #define INCL_NOPMAPI #include -/* convert 16:16 adress to 0:32 */ +/* convert 16:16 address to 0:32 */ #define SELTOFLAT(ptr) (void *)(((((ULONG)(ptr))>>19)<<16)|(0xFFFF&((ULONG)(ptr)))) #if defined(HARBOUR_GCC_OS2) @@ -78,7 +78,6 @@ static char hb_gt_GetCellSize( void ); - static char * hb_gt_ScreenPtr( USHORT cRow, USHORT cCol ); static void hb_gt_xGetXY( USHORT cRow, USHORT cCol, BYTE * attr, BYTE * ch ); static void hb_gt_xPutch( USHORT cRow, USHORT cCol, BYTE attr, BYTE ch ); @@ -87,12 +86,15 @@ static void hb_gt_xPutch( USHORT cRow, USHORT cCol, BYTE attr, BYTE ch ); static void hb_gt_GetCursorSize( char * start, char * end ); */ +/* how many nested BeginDisp() */ static USHORT s_uiDispCount; /* pointer to offscreen video buffer */ -static PULONG LVBptr; +static ULONG s_ulLVBptr; + /* length of video buffer */ -static USHORT LVBlength; +static USHORT s_usLVBlength; + void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) { @@ -100,10 +102,10 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) s_uiDispCount = 0; - if(VioGetBuf(&LVBptr, &LVBlength, 0) == NO_ERROR) { - LVBptr = SELTOFLAT(LVBptr); + if(VioGetBuf(&s_ulLVBptr, &s_usLVBlength, 0) == NO_ERROR) { + s_ulLVBptr = (ULONG) SELTOFLAT(s_ulLVBptr); } else { - LVBptr = NULL; + s_ulLVBptr = (ULONG) NULL; } /* TODO: Is anything required to initialize the video subsystem? @@ -361,25 +363,90 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, { /* Chen Kedem */ - BYTE bCell[ 2 ]; /* character/attribute pair */ + HB_TRACE(HB_TR_DEBUG, ("hb_gt_Scroll(%hu, %hu, %hu, %hu, %d, %hd, %hd)", usTop, usLeft, usBottom, usRigth, (int) attr, sVert, sHoriz)); - HB_TRACE(HB_TR_DEBUG, ("hb_gt_Scroll(%hu, %hu, %hu, %hu, %d, %hd, %hd)", usTop, usLeft, usBottom, usRigth, (int) attr, sVert, sHoriz)); + if(s_uiDispCount > 0) { + int iRows = sVert, iCols = sHoriz; - bCell [ 0 ] = ' '; - bCell [ 1 ] = attr; - if( ( sVert | sHoriz ) == 0 ) /* both zero, clear region */ - VioScrollUp ( usTop, usLeft, usBottom, usRight, 0xFFFF, bCell, 0 ); - else - { - if( sVert > 0 ) /* scroll up */ - VioScrollUp ( usTop, usLeft, usBottom, usRight, sVert, bCell, 0 ); - else if( sVert < 0 ) /* scroll down */ - VioScrollDn ( usTop, usLeft, usBottom, usRight, -sVert, bCell, 0 ); + /* NOTE: 'SHORT' is used intentionally to correctly compile + * with C++ compilers + */ + SHORT usRow, usCol; + USHORT uiSize; /* gtRectSize returns int */ + int iLength = ( usRight - usLeft ) + 1; + int iCount, iColOld, iColNew, iColSize; - if( sHoriz > 0 ) /* scroll left */ - VioScrollLf ( usTop, usLeft, usBottom, usRight, sHoriz, bCell, 0 ); - else if( sHoriz < 0 ) /* scroll right */ - VioScrollRt ( usTop, usLeft, usBottom, usRight, -sHoriz, bCell, 0 ); + hb_gtGetPos( &usRow, &usCol ); + + if( hb_gtRectSize( usTop, usLeft, usBottom, usRight, &uiSize ) == 0 ) + { + /* NOTE: 'unsigned' is used intentionally to correctly compile + * with C++ compilers + */ + unsigned char * fpBlank = ( unsigned char * ) hb_xgrab( iLength ); + unsigned char * fpBuff = ( unsigned char * ) hb_xgrab( iLength * 2 ); + + memset( fpBlank, ' ', iLength ); + + iColOld = iColNew = usLeft; + if( iCols >= 0 ) + { + iColOld += iCols; + iColSize = ( int ) ( usRight - usLeft ); + iColSize -= iCols; + } + else + { + iColNew -= iCols; + iColSize = ( int ) ( usRight - usLeft ); + iColSize += iCols; + } + + for( iCount = ( iRows >= 0 ? usTop : usBottom ); + ( iRows >= 0 ? iCount <= usBottom : iCount >= usTop ); + ( iRows >= 0 ? iCount++ : iCount-- ) ) + { + int iRowPos = iCount + iRows; + + /* Blank the scroll region in the current row */ + hb_gt_Puts( iCount, usLeft, attr, fpBlank, iLength ); + + if( ( iRows || iCols ) && iRowPos <= usBottom && iRowPos >= usTop ) + { + /* Read the text to be scrolled into the current row */ + hb_gt_GetText( iRowPos, iColOld, iRowPos, iColOld + iColSize, fpBuff ); + + /* Write the scrolled text to the current row */ + hb_gt_PutText( iCount, iColNew, iCount, iColNew + iColSize, fpBuff ); + } + } + + hb_xfree( fpBlank ); + hb_xfree( fpBuff ); + } + + hb_gtSetPos( usRow, usCol ); + + } else { + + BYTE bCell[ 2 ]; /* character/attribute pair */ + + bCell [ 0 ] = ' '; + bCell [ 1 ] = attr; + if( ( sVert | sHoriz ) == 0 ) /* both zero, clear region */ + VioScrollUp ( usTop, usLeft, usBottom, usRight, 0xFFFF, bCell, 0 ); + else + { + if( sVert > 0 ) /* scroll up */ + VioScrollUp ( usTop, usLeft, usBottom, usRight, sVert, bCell, 0 ); + else if( sVert < 0 ) /* scroll down */ + VioScrollDn ( usTop, usLeft, usBottom, usRight, -sVert, bCell, 0 ); + + if( sHoriz > 0 ) /* scroll left */ + VioScrollLf ( usTop, usLeft, usBottom, usRight, sHoriz, bCell, 0 ); + else if( sHoriz < 0 ) /* scroll right */ + VioScrollRt ( usTop, usLeft, usBottom, usRight, -sHoriz, bCell, 0 ); + } } } @@ -508,7 +575,7 @@ static char * hb_gt_ScreenPtr( USHORT cRow, USHORT cCol ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_ScreenPtr(%hu, %hu)", cRow, cCol)); - return (char *) (LVBptr + ( cRow * hb_gt_GetScreenWidth() * 2 ) + ( cCol * 2 )); + return (char *) (s_ulLVBptr + ( cRow * hb_gt_GetScreenWidth() * 2 ) + ( cCol * 2 )); } @@ -612,7 +679,7 @@ void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT us HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetAttribute(%hu, %hu, %hu, %hu, %d)", usTop, usLeft, usBottom, usRigth, (int) attr)); - if(s_uiDispCount > 0) { + if(s_uiDispCount >0) { USHORT x, y; @@ -662,7 +729,7 @@ void hb_gt_DispEnd( void ) HB_TRACE(HB_TR_DEBUG, ("hb_gt_DispEnd()")); if (--s_uiDispCount == 0) { - VioShowBuf(0, LVBlength, 0); /* refresh everything */ + VioShowBuf(0, s_usLVBlength, 0); /* refresh everything */ } }