diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 373781e6a3..ae4a9fcefb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,33 @@ +20000416-13:05 GMT+1 Ryszard Glab + + *config/linux/gcc.cf + *fixed to automatically select a proper screen library + + *include/hbapigt.h + *source/rtl/gtapi.c + *source/rtl/gt_tpl/gt_tpl.c + *source/rtl/gtcrs/gtcrs.c + *source/rtl/gtdos/gtdos.c + *source/rtl/gtos2/gtos2.c + *source/rtl/gtpca/gtpca.c + *source/rtl/gtsln/gtsln.c + *source/rtl/gtstd/gtstd.c + *source/rtl/gtwin/gtwin.c + *number of bytes required for a given rectangle size is + calculated in the lowest level function + hb_gt_RectSize( rows, cols ) - some screen drivers can + store screen image in more complex method then byte+byte + + *source/rtl/gtcrs/gtcrs.c + *full support for scrolling was added + *full ASCII character set enabled including box drawing characters + (however this don't work under xterm) + *save/restore screen are available + + *source/rdd/dbfcdx/dbfcdx1.c + * fixed NULL into 0 for string termination character (NULL in gcc + compiler is defined as a pointer) + 20000416-12:34 GMT+1 Victor Szakats * source/lang/msgfr.c diff --git a/harbour/config/linux/gcc.cf b/harbour/config/linux/gcc.cf index f95c1ef389..57782fbf7d 100644 --- a/harbour/config/linux/gcc.cf +++ b/harbour/config/linux/gcc.cf @@ -13,7 +13,7 @@ CC = gcc CC_IN = -c CC_OUT = -o CPPFLAGS = -I. -I$(HB_INC_COMPILE) -CFLAGS = -Wall +CFLAGS = -Wall -g LD = gcc LD_OUT = -o @@ -40,8 +40,13 @@ LINKLIBS += -l$(HB_GT_LIB) endif # HB_SCREEN_LIB: empty, or one of ncurses, slang -HB_SCREEN_LIB=ncurses -# HB_SCREEN_LIB=slang +ifeq ($(HB_GT_LIB),gtcrs) +HB_SCREEN_LIB:=ncurses +else +ifeq ($(HB_GT_LIB),gtsln) +HB_SCREEN_LIB:=slang +endif +endif ifneq ($(HB_SCREEN_LIB),) LINKLIBS += -l$(HB_SCREEN_LIB) diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index b97c9cf160..f7a9c28d9c 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -164,6 +164,7 @@ extern BOOL hb_gt_IsColor( void ); extern void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG ulLen ); extern void hb_gt_PutText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbySrc ); extern int hb_gt_ReadKey( HB_inkey_enum eventmask ); +extern int hb_gt_RectSize( USHORT rows, USHORT cols ); extern void hb_gt_Replicate( BYTE byChar, ULONG ulLen ); extern SHORT hb_gt_Row( void ); extern void hb_gt_Scroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr, SHORT iRows, SHORT iCols ); diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index 29408c5a35..5ad529c1a7 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -922,7 +922,7 @@ static void hb_cdxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey ) while( pNewKey->pItem->item.asString.length > 0 && pNewKey->pItem->item.asString.value[ pNewKey->pItem->item.asString.length - 1 ] == ' ' ) pNewKey->pItem->item.asString.length--; - pNewKey->pItem->item.asString.value[ pNewKey->pItem->item.asString.length ] = NULL; + pNewKey->pItem->item.asString.value[ pNewKey->pItem->item.asString.length ] = 0; } pTag->TagBOF = pTag->TagEOF = FALSE; iSeek = hb_cdxPageSeekKey( pTag->RootPage, pNewKey->Tag, pNewKey, TRUE ); @@ -1155,7 +1155,7 @@ static void hb_cdxTagExtNodeBuild( LPTAGINFO pTag, LPCDXDATA pData, LPPAGEINFO P if( pTag->KeyLength - d - t > 0 ) memcpy( &szBuffer[ d ], &pData->cdxu.External.ExtData[ k ], pTag->KeyLength - d - t ); - szBuffer[ pTag->KeyLength - t ] = NULL; + szBuffer[ pTag->KeyLength - t ] = 0; pKey = hb_cdxKeyNew(); pKey->Tag = r; pKey->Xtra = r; @@ -1227,7 +1227,7 @@ static void hb_cdxTagTagLoad( LPTAGINFO pTag ) break; } - if( pHeader.KeyPool[ strlen( pTag->KeyExpr ) + 1 ] == NULL ) + if( pHeader.KeyPool[ strlen( pTag->KeyExpr ) + 1 ] == 0 ) return; pTag->ForExpr = ( char * ) hb_xgrab( CDX_MAX_KEY + 1 ); hb_strncpyUpper( pTag->ForExpr, ( const char * ) pHeader.KeyPool + @@ -1371,7 +1371,7 @@ static void hb_cdxTagIntNodeBuild( LPTAGINFO pTag, LPCDXDATA pData, LPPAGEINFO p { v = i * ( pTag->KeyLength + 8 ); memmove( szBuffer, pData->cdxu.Internal.IntData + v, pTag->KeyLength ); - szBuffer[ pTag->KeyLength ] = NULL; + szBuffer[ pTag->KeyLength ] = 0; v += pTag->KeyLength; memcpy( &r, &pData->cdxu.Internal.IntData[ v ], 4 ); r = hb_cdxSwapBytes( r ); @@ -1383,7 +1383,7 @@ static void hb_cdxTagIntNodeBuild( LPTAGINFO pTag, LPCDXDATA pData, LPPAGEINFO p v = strlen( szBuffer ); while( v > 0 && szBuffer[ v - 1 ] == 32 ) v--; - szBuffer[ v ] = NULL; + szBuffer[ v ] = 0; } else { @@ -1424,7 +1424,7 @@ static LONG hb_cdxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey ) while( stot->pItem->item.asString.length > 0 && stot->pItem->item.asString.value[ stot->pItem->item.asString.length - 1 ] == ' ' ) stot->pItem->item.asString.length--; - stot->pItem->item.asString.value[ stot->pItem->item.asString.length ] = NULL; + stot->pItem->item.asString.value[ stot->pItem->item.asString.length ] = 0; } pTag->TagBOF = pTag->TagEOF = FALSE; K = hb_cdxPageSeekKey( pTag->RootPage, stot->Tag, stot, FALSE ); @@ -2037,7 +2037,7 @@ static void hb_cdxSortFree( LPSORTINFO pSort ) { for( usCount = 0; usCount < pSort->ChunkLimit; usCount++ ) { - if( pSort->ChunkList[ usCount ] != NULL ) + if( pSort->ChunkList[ usCount ] != 0 ) hb_xfree( ( BYTE * ) pSort->ChunkList[ usCount ] ); } hb_xfree( pSort->ChunkList ); @@ -2108,7 +2108,7 @@ static void hb_cdxSortInsertWord( LPSORTINFO pSort, LONG Tag, char * Value ) } while( v >= 0 && pSort->WPch[ v ] == ' ' ) { - pSort->WPch[ v ] = NULL; + pSort->WPch[ v ] = 0; v--; } v++; @@ -2118,7 +2118,7 @@ static void hb_cdxSortInsertWord( LPSORTINFO pSort, LONG Tag, char * Value ) s[ 0 ] = ( char ) strlen( s + 1 ); memcpy( &pSort->WPch[ v ], s, s[ 0 ] + 1 ); v += ( SHORT ) ( s[ 0 ] + 1 ); - pSort->WPch[ v ] = NULL; + pSort->WPch[ v ] = 0; } pSort->LevelPtr = pSort->RootLink; pSort->PriorPtr = 0; @@ -2135,7 +2135,7 @@ static void hb_cdxSortInsertWord( LPSORTINFO pSort, LONG Tag, char * Value ) EOK++; memcpy( &pSort->WPch[ EOK ], s, s[ 0 ] + 1 ); v = EOK + s[ 0 ] + 1; - pSort->WPch[ v ] = NULL; + pSort->WPch[ v ] = 0; do hb_cdxSortStuffKey( pSort, &wx ); while( pSort->WPch[ pSort->WCur ] != 0 ); @@ -2204,7 +2204,7 @@ static void hb_cdxSortGetNode( LPSORTINFO pSort, char Character, LONG * NewLink px = hb_cdxSortLinkGet( pSort, p ); px->sortu.A.Character = px->sortu.B.ChrStack[ 0 ]; memmove( &px->sortu.B.ChrStack[ 0 ], &px->sortu.B.ChrStack[ 1 ], 3 ); - px->sortu.B.ChrStack[ 3 ] = NULL; + px->sortu.B.ChrStack[ 3 ] = 0; if( px->sortu.C.ChrFill != 0 ) px->sortu.A.NUse = SORT_STACK_OF_CHAR; else @@ -2237,7 +2237,7 @@ static void hb_cdxSortGetNode( LPSORTINFO pSort, char Character, LONG * NewLink px = hb_cdxSortLinkGet( pSort, p ); px->sortu.A.Character = px->sortu.B.ChrStack[ 0 ]; memmove( &px->sortu.B.ChrStack[ 0 ], &px->sortu.B.ChrStack[ 1 ], 3 ); - px->sortu.B.ChrStack[ 3 ] = NULL; + px->sortu.B.ChrStack[ 3 ] = 0; if( px->sortu.C.ChrFill != 0 ) px->sortu.A.NUse = SORT_STACK_OF_CHAR; else @@ -2296,7 +2296,7 @@ static LPSORTDATA hb_cdxSortLinkGet( LPSORTINFO pSort, LONG Value ) static void hb_cdxSortDisplayWord( LPSORTINFO pSort ) { - pSort->WPch[ 0 ] = NULL; + pSort->WPch[ 0 ] = 0; hb_cdxSortRecurseDict( pSort, pSort->RootLink, 0 ); } @@ -2311,12 +2311,12 @@ static void hb_cdxSortRecurseDict( LPSORTINFO pSort, LONG WPtr, LONG WBgn ) if( pSort->WAdr->sortu.A.Character != 0 ) { pSort->WPch[ WCnt ] = pSort->WAdr->sortu.A.Character; - pSort->WPch[ WCnt + 1 ] = NULL; + pSort->WPch[ WCnt + 1 ] = 0; } if( pSort->WAdr->sortu.A.NUse == SORT_STACK_OF_CHAR ) { memcpy( &pSort->WPch[ strlen( pSort->WPch ) ], pSort->WAdr->sortu.B.ChrStack, 4 ); - pSort->WPch[ WCnt + 5 ] = NULL; + pSort->WPch[ WCnt + 5 ] = 0; } if( pSort->WAdr->sortu.A.NUse == SORT_END_OF_WORD ) hb_cdxSortSendWord( pSort, pSort->WPch ); @@ -2326,7 +2326,7 @@ static void hb_cdxSortRecurseDict( LPSORTINFO pSort, LONG WPtr, LONG WBgn ) hb_cdxSortRecurseDict( pSort, pSort->WAdr->sortu.A.WordArray, WBgn ); pSort->WAdr = hb_cdxSortLinkGet( pSort, WPtr ); } - pSort->WPch[ WCnt ] = NULL; + pSort->WPch[ WCnt ] = 0; if( pSort->WAdr->sortu.A.LevelLink != 0 && pSort->WAdr->sortu.A.NUse != SORT_STACK_OF_CHAR ) hb_cdxSortRecurseDict( pSort, pSort->WAdr->sortu.A.LevelLink, WCnt ); } @@ -2342,7 +2342,7 @@ static void hb_cdxSortSendWord( LPSORTINFO pSort, char * Value ) pce--; Tag = atol( pce + 1 ); OldByte = pce[ 0 ]; - pce[ 0 ] = NULL; + pce[ 0 ] = 0; hb_cdxSortOutputWord( pSort, Tag, Value ); pce[ 0 ] = OldByte; } @@ -2996,7 +2996,7 @@ static ERRCODE cdxOrderCreate( AREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) uiCount = strlen( szTagName ); while( uiCount > 0 && szTagName[ uiCount - 1 ] == ' ' ) uiCount--; - szTagName[ uiCount ] = NULL; + szTagName[ uiCount ] = 0; hb_cdxIndexAddTag( pIndex, szTagName, pOrderInfo->abExpr->item.asString.value, pKeyExp, bType, uiLen, ( char * ) ( pArea->lpdbOrdCondInfo ? pArea->lpdbOrdCondInfo->abFor : NULL ), pForExp, pArea->lpdbOrdCondInfo ? diff --git a/harbour/source/rtl/gt_tpl/gt_tpl.c b/harbour/source/rtl/gt_tpl/gt_tpl.c index dd9b7d6ea9..a18acba6b5 100644 --- a/harbour/source/rtl/gt_tpl/gt_tpl.c +++ b/harbour/source/rtl/gt_tpl/gt_tpl.c @@ -236,6 +236,11 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG u HB_SYMBOL_UNUSED( ulLen ); } +int hb_gt_RectSize( USHORT rows, USHORT cols ) +{ + return rows * cols * 2; +} + void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst)); diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 9566013416..9c4150e2eb 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -716,7 +716,7 @@ USHORT hb_gtRectSize( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRig { HB_TRACE(HB_TR_DEBUG, ("hb_gtRectSize(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, uipBuffSize)); - *uipBuffSize = ( uiBottom - uiTop + 1 ) * ( uiRight - uiLeft + 1 ) * 2; + *uipBuffSize = hb_gt_RectSize( uiBottom - uiTop + 1, uiRight - uiLeft + 1 ); return 0; } diff --git a/harbour/source/rtl/gtcrs/gtcrs.c b/harbour/source/rtl/gtcrs/gtcrs.c index 6e608ddd66..59aa8e9b10 100644 --- a/harbour/source/rtl/gtcrs/gtcrs.c +++ b/harbour/source/rtl/gtcrs/gtcrs.c @@ -34,6 +34,7 @@ */ #include +#include #include "hbapigt.h" #include "hbinit.h" @@ -62,14 +63,11 @@ struct key_map_struc static struct key_map_struc *s_keymap_table = NULL; static unsigned s_attribmap_table[ 256 ]; /* mapping from DOS style attributes */ +static BOOL s_under_buggy_xterm; +static int s_alternate_char_set; -void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) +static void hb_gt_Initialize_Terminal( void ) { - HB_TRACE(HB_TR_DEBUG, ("hb_gt_Init()")); - - s_uiDispCount = 0; - - initscr(); if( has_colors() ) { int i; @@ -99,7 +97,7 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) start_color(); for( backg=0; backg 0 ) + { + pTmp = pScreen; + for( i=0; i=iCols; j-- ) + pTmp[ j ] = pTmp[ j-1 ]; + for( j=0; j s_usMaxCol ) s_usCol = s_usMaxCol; } +int hb_gt_RectSize( USHORT rows, USHORT cols ) +{ + return rows * cols * 2; +} + void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE *dest ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", usTop, usLeft, usBottom, usRight, dest)); diff --git a/harbour/source/rtl/gtsln/gtsln.c b/harbour/source/rtl/gtsln/gtsln.c index 312d9f1a06..871c2b6890 100644 --- a/harbour/source/rtl/gtsln/gtsln.c +++ b/harbour/source/rtl/gtsln/gtsln.c @@ -236,6 +236,11 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG u SLsmg_write_nchars(pbyStr, ulLen); } +int hb_gt_RectSize( USHORT rows, USHORT cols ) +{ + return rows * cols * 2; +} + void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst)); diff --git a/harbour/source/rtl/gtstd/gtstd.c b/harbour/source/rtl/gtstd/gtstd.c index 70afbb8650..e18407095a 100644 --- a/harbour/source/rtl/gtstd/gtstd.c +++ b/harbour/source/rtl/gtstd/gtstd.c @@ -243,6 +243,11 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG u HB_SYMBOL_UNUSED( ulLen ); } +int hb_gt_RectSize( USHORT rows, USHORT cols ) +{ + return rows * cols * 2; +} + void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst)); diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index 9338528560..1540e60d40 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -812,6 +812,11 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE attr, BYTE * str, ULONG len ) WriteConsoleOutputCharacterA( s_HOutput, ( char * ) str, ( DWORD ) len, coord, &dwWritten ); } +int hb_gt_RectSize( USHORT rows, USHORT cols ) +{ + return rows * cols * 2; +} + void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * dest ) { LPWORD pwattr; diff --git a/harbour/tests/scroll.prg b/harbour/tests/scroll.prg index 8359bb4744..a78b6d6e7d 100644 --- a/harbour/tests/scroll.prg +++ b/harbour/tests/scroll.prg @@ -8,8 +8,10 @@ Copyright 1999 David G. Holm See doc/hdr_tpl.txt, Version 1.2 or later, for licensing terms. */ +#include "box.ch" function main() +local ct DEVPOS(MAXROW(),0) DispBegin() @@ -22,7 +24,10 @@ function main() ? DispEnd() Pause() + +SET COLOR TO "GR+/RB" CLS + @ 0,0,14,45 BOX B_SINGLE @ 0,0 SAY "01234567890123456789012345678901" @ 1,0 SAY "01234567890123456789012345678901" @ 2,0 SAY "01234567890123456789012345678901" @@ -36,7 +41,14 @@ function main() @ 10,0 SAY "01234567890123456789012345678901" @ 11,0 SAY "01234567890123456789012345678901" @ 12,0 SAY "01234567890123456789012345678901" + @ 13,0 SAY "0 1 2 3 " Pause() + +//save/restore test + cT := SAVESCREEN( 0,0, 13, 31 ) + RESTSCREEN( 10,40, 23, 71, cT ) + pause() + Scroll (1, 1, 11, 30, -2, -5) pause() Scroll (1, 1, 11, 30, 2, 5) @@ -45,7 +57,8 @@ function main() pause() Scroll (1, 1, 11, 30, 7, -12) pause() - Scroll (1, 1, 11, 30) + SET COLOR TO "W+/R" + Scroll (1, 1, 11, 30, 0, 0 ) pause() return nil