From e19e015ae835bdabd72036c25c257a464efdd688 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 14 Jul 2007 20:55:26 +0000 Subject: [PATCH] 2007-07-14 22:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/gttrm/gttrm.c * added protection against corrupted by programmer screen buffer * harbour/source/rtl/hbgtcore.c * extended hb_gtColorToN() to recognize also "I", "N", "U" and numeric NN/NN attributes * harbour/contrib/libct/ftoc.c * cleanup * harbour/contrib/libct/Makefile * harbour/contrib/libct/makefile.bc * harbour/contrib/libct/makefile.vc - harbour/contrib/libct/color.prg - harbour/contrib/libct/invrtwin.prg + harbour/contrib/libct/color.c * rewritten INVERTATTR(), INVERTWIN(), COLORTON(), NTOCOLOR(), ENHANCED(), STANDARD(), UNSELECTED() in C code. Now COLORTON() and NTOCOLOR() use GT functions for color translations. ! fixed INVERTATTR() to not change blink and highlight attributes ! fixed INVERTWIN() to work with GT divers which do not use VGA compatible screen buffer --- harbour/ChangeLog | 24 ++ harbour/contrib/libct/Makefile | 3 +- harbour/contrib/libct/{color.prg => color.c} | 317 +++++++++---------- harbour/contrib/libct/ftoc.c | 39 +-- harbour/contrib/libct/invrtwin.prg | 119 ------- harbour/contrib/libct/makefile.bc | 67 ++-- harbour/contrib/libct/makefile.vc | 22 +- harbour/source/rtl/gttrm/gttrm.c | 1 + harbour/source/rtl/hbgtcore.c | 34 +- 9 files changed, 260 insertions(+), 366 deletions(-) rename harbour/contrib/libct/{color.prg => color.c} (54%) delete mode 100644 harbour/contrib/libct/invrtwin.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6da50cceb5..d6909ba37f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,30 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-07-14 22:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/gttrm/gttrm.c + * added protection against corrupted by programmer screen buffer + + * harbour/source/rtl/hbgtcore.c + * extended hb_gtColorToN() to recognize also "I", "N", "U" and + numeric NN/NN attributes + + * harbour/contrib/libct/ftoc.c + * cleanup + + * harbour/contrib/libct/Makefile + * harbour/contrib/libct/makefile.bc + * harbour/contrib/libct/makefile.vc + - harbour/contrib/libct/color.prg + - harbour/contrib/libct/invrtwin.prg + + harbour/contrib/libct/color.c + * rewritten INVERTATTR(), INVERTWIN(), COLORTON(), NTOCOLOR(), + ENHANCED(), STANDARD(), UNSELECTED() in C code. Now COLORTON() + and NTOCOLOR() use GT functions for color translations. + ! fixed INVERTATTR() to not change blink and highlight attributes + ! fixed INVERTWIN() to work with GT divers which do not use VGA + compatible screen buffer + 2007-07-14 12:31 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbcompat.ch ! changed hb_adler() to hb_adler32() diff --git a/harbour/contrib/libct/Makefile b/harbour/contrib/libct/Makefile index 7a201d2c65..1b48a27340 100644 --- a/harbour/contrib/libct/Makefile +++ b/harbour/contrib/libct/Makefile @@ -22,6 +22,7 @@ C_SOURCES = \ charrepl.c \ charsort.c \ charswap.c \ + color.c \ count.c \ ctc.c \ ctmath.c \ @@ -66,11 +67,9 @@ C_SOURCES = \ wordtoch.c \ PRG_SOURCES= \ - color.prg \ ct.prg \ ctmisc.prg \ cttime.prg \ - invrtwin.prg \ numconv.prg \ screen2.prg \ setlast.prg \ diff --git a/harbour/contrib/libct/color.prg b/harbour/contrib/libct/color.c similarity index 54% rename from harbour/contrib/libct/color.prg rename to harbour/contrib/libct/color.c index b61273a23f..9a13b9cdb7 100644 --- a/harbour/contrib/libct/color.prg +++ b/harbour/contrib/libct/color.c @@ -4,20 +4,9 @@ /* * Harbour Project source code: - * CT3 video functions (color-like functions) + * CT3 video function: - INVERTATTR(), INVERTWIN(), COLORTON() * - * Copyright 2004 Phil Krylov : - * - INVERTATTR() - * - * Copyright 2002 Walter Negro : - * - NTOCOLOR() - * - COLORTON() - * - * Copyright 1999-2001 Viktor Szakats : - * - ENHANCED() - * - STANDARD() - * - UNSELECTED() - * + * Copyright 2007 Przemyslaw Czerpak * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -61,125 +50,104 @@ * */ -#include "color.ch" -#include "common.ch" - - -FUNCTION INVERTATTR( xAttr ) - LOCAL n := ColorToN( xAttr ) -RETURN HB_BITSHIFT( HB_BITAND( n, 0x0F ), 4 ) + HB_BITSHIFT( n, -4 ) - +#include "hbapi.h" +#include "hbapigt.h" /* $DOC$ * $FUNCNAME$ - * NTOCOLOR() + * INVERTATTR() * $CATEGORY$ * CT3 video functions * $ONELINER$ + * * $SYNTAX$ - * NTOCOLOR ( , [] ) -> + * * $ARGUMENTS$ - * Designates the value for the combined numeric color - * attributes. - * - * If designated as .F. or if the parameter is omitted, - * NTOCOLOR() returns a string with a numeric color code. - * When designated as .T., NTOCOLOR() returns a string with - * the CA-Clipper alpha color coding. - * * $RETURNS$ - * NTOCOLOR() returns the designated color attribute in the NN/NN - * or CC/CC form. - * * $DESCRIPTION$ - * NTOCOLOR() converts a color attribute returned from another function - * in numeric form, into the alphanumeric data format. Use this - * attribute in conjunction with the CA-Clipper SET COLOR TO command. - * * TODO: add documentation * $EXAMPLES$ * $TESTS$ * $STATUS$ * Started * $COMPLIANCE$ + * INVERTATTR() is compatible with CT3's INVERTATTR(). * $PLATFORMS$ * All * $FILES$ - * Source is color.prg, library is libct. + * Source is invertcl.c, library is libct. * $SEEALSO$ * $END$ */ -FUNCTION NTOCOLOR( nColor, lChar ) +HB_FUNC( INVERTATTR ) +{ + int iAttr; - local nColorFore - local nColorBack - local lHiColor - local lBlinking - local cColor := "" + iAttr = ISCHAR( 1 ) ? hb_gtColorToN( hb_parc( 1 ) ) : hb_parni( 1 ); + hb_retni( ( iAttr & 0x88 ) | + ( ( iAttr & 0x07 ) << 4 ) | + ( ( iAttr >> 4 ) & 0x07 ) ); +} - DEFAULT lChar TO .f. - if valtype( nColor ) == "N" .and. nColor >= 0 .and. nColor < 256 +/* $DOC$ + * $FUNCNAME$ + * INVERTWIN() + * $CATEGORY$ + * CT3 video functions + * $ONELINER$ + * + * $SYNTAX$ + * + * $ARGUMENTS$ + * $RETURNS$ + * $DESCRIPTION$ + * TODO: add documentation + * $EXAMPLES$ + * $TESTS$ + * $STATUS$ + * Started + * $COMPLIANCE$ + * INVERTWIN() is compatible with CT3's INVERTWIN(). + * $PLATFORMS$ + * All + * $FILES$ + * Source is invertcl.c, library is libct. + * $SEEALSO$ + * $END$ + */ - nColorFore = nColor % 16 - nColorBack = INT( nColor / 16 ) +HB_FUNC( INVERTWIN ) +{ + int iTop, iLeft, iBottom, iRight; + SHORT sTop, sLeft; - if !lChar + hb_gtGetPos( &sTop, &sLeft ); - cColor = strzero( nColorFore, 2 ) + "/" + strzero( nColorBack, 2 ) + iTop = ISNUM( 1 ) ? hb_parni( 1 ) : sTop; + iLeft = ISNUM( 2 ) ? hb_parni( 2 ) : sLeft; + iBottom = ISNUM( 3 ) ? hb_parni( 3 ) : hb_gtMaxRow(); + iRight = ISNUM( 4 ) ? hb_parni( 4 ) : hb_gtMaxCol(); - else - - lHiColor = nColorFore > 7 - lBlinking = nColorBack > 7 + while( iTop <= iBottom ) + { + int iCol = iLeft; + while( iCol <= iRight ) + { + BYTE bColor, bAttr; + USHORT usChar; - nColorFore = nColorFore % 8 - nColorBack = nColorBack % 8 - - cColor = n2c( nColorFore ) + if( lHiColor, "+", "" ) + "/" +; - n2c( nColorBack ) + if( lBlinking, "*", "" ) - - endif - endif - - return cColor - -static function n2c( nColor ) - - do case - case nColor = 0 - return "N" - case nColor = 1 - return "B" - case nColor = 2 - return "G" - case nColor = 3 - return "BG" - case nColor = 4 - return "R" - case nColor = 5 - return "BR" - case nColor = 6 - return "GR" - case nColor = 7 - return "W" - endcase - - return "" - -static function c2n( cColor ) - - local nColor := 0 - - cColor = upper( cColor ) - - nColor += if( "B" $ cColor, 1, 0 ) - nColor += if( "G" $ cColor, 2, 0 ) - nColor += if( "R" $ cColor, 4, 0 ) - nColor += if( "W" $ cColor, 7, 0 ) - - return nColor + hb_gtGetChar( iTop, iCol, &bColor, &bAttr, &usChar ); + bColor = ( bColor & 0x88 ) | + ( ( bColor & 0x07 ) << 4 ) | + ( ( bColor >> 4 ) & 0x07 ); + hb_gtPutChar( iTop, iCol, bColor, bAttr, usChar ); + ++iCol; + } + ++iTop; + } +} /* $DOC$ @@ -220,70 +188,71 @@ static function c2n( cColor ) * $END$ */ -FUNCTION COLORTON( cColor ) +HB_FUNC( COLORTON ) +{ + if( ISCHAR( 1 ) ) + hb_retni( hb_gtColorToN( hb_parc( 1 ) ) ); + else + hb_retni( hb_parni( 1 ) ); +} - local cColorFore, cColorBack - local nColorFore, nColorBack - local lHiColor := .f., lBlinking := .f. - local nSep - if valtype( cColor ) == "N" - return cColor - endif +/* $DOC$ + * $FUNCNAME$ + * COLORTON() + * $CATEGORY$ + * CT3 video functions + * $ONELINER$ + * $SYNTAX$ + * COLORTON ( ) -> + * $ARGUMENTS$ + * Designates the alphanumeric color attribute that is + * converted in NN/NN or CC/CC form. + * + * $RETURNS$ + * COLORTON() returns a number that corresponds to the combined numeric + * color attribute. + * + * $DESCRIPTION$ + * COLOR TO (N)umeric + * The function changes an alphanumeric color attribute from NN/NN or + * CC/CC into a combined numeric attribute. These combined attribute + * values are useful with the CA-Clipper Tools functions STRSCREEN(), + * SCREENMIX(), SCREENATTR(), and the CA-Clipper commands + * SAVE/RESTORE SCREEN. + * + * TODO: add documentation + * $EXAMPLES$ + * $TESTS$ + * $STATUS$ + * Started + * $COMPLIANCE$ + * $PLATFORMS$ + * All + * $FILES$ + * Source is color.prg, library is libct. + * $SEEALSO$ + * $END$ + */ - if valtype( cColor ) == "C" +HB_FUNC( NTOCOLOR ) +{ + char szColorString[ 10 ]; + int iColor; - if ( nSep := at( ",", cColor ) ) <> 0 - cColor := left( cColor, nSep - 1 ) - endif + iColor = ISNUM( 1 ) ? hb_parni( 1 ) : -1; - if ( nSep := at( "/", cColor ) ) == 0 - - cColorFore = cColor - cColorBack = "" - else - - cColorFore = alltrim( substr( cColor, 1, nSep - 1 ) ) - cColorBack = alltrim( substr( cColor, nSep + 1 ) ) - endif - - if "+" $ cColorFore .or. "+" $ cColorBack - lHiColor = .t. - cColorFore = strtran( cColorFore, "+", "" ) - cColorBack = strtran( cColorBack, "+", "" ) - endif - - if "*" $ cColorFore .or. "*" $ cColorBack - lBlinking = .t. - cColorFore = strtran( cColorFore, "*", "" ) - cColorBack = strtran( cColorBack, "*", "" ) - endif - - nColorFore = val( cColorFore ) - nColorBack = val( cColorBack ) - - if nColorFore > 0 .or. nColorBack > 0 - return nColorFore + nColorBack * 16 - endif - - if len( cColorFore ) > 2 .or. len( cColorBack ) > 2 - return 0 - endif - - nColorFore = c2n( cColorFore ) - nColorBack = c2n( cColorBack ) - - if nColorFore > 7 .or. nColorBack > 7 - return 0 - endif - - nColorFore += if( lHiColor, 8, 0 ) - nColorBack += if( lBlinking, 8, 0 ) - - return nColorFore + nColorBack * 16 - endif - - return 0 + if( iColor >= 0x00 && iColor <= 0xff ) + { + if( ISLOG( 2 ) && hb_parl( 2 ) ) + hb_gtColorsToString( &iColor, 1, szColorString, 10 ); + else + snprintf( szColorString, 10, "%02d/%02d", iColor & 0x0f, iColor >> 4 ); + hb_retc( szColorString ); + } + else + hb_retc( NULL ); +} /* $DOC$ @@ -314,11 +283,12 @@ FUNCTION COLORTON( cColor ) * $END$ */ -FUNCTION ENHANCED() +HB_FUNC( ENHANCED ) +{ + hb_gtColorSelect( HB_CLR_ENHANCED ); + hb_retc( NULL ); +} - ColorSelect( CLR_ENHANCED ) - - RETURN "" /* $DOC$ * $FUNCNAME$ @@ -348,11 +318,12 @@ FUNCTION ENHANCED() * $END$ */ -FUNCTION STANDARD() +HB_FUNC( STANDARD ) +{ + hb_gtColorSelect( HB_CLR_STANDARD ); + hb_retc( NULL ); +} - ColorSelect( CLR_STANDARD ) - - RETURN "" /* $DOC$ * $FUNCNAME$ @@ -382,8 +353,8 @@ FUNCTION STANDARD() * $END$ */ -FUNCTION UNSELECTED() - - ColorSelect( CLR_UNSELECTED ) - - RETURN "" +HB_FUNC( UNSELECTED ) +{ + hb_gtColorSelect( HB_CLR_UNSELECTED ); + hb_retc( NULL ); +} diff --git a/harbour/contrib/libct/ftoc.c b/harbour/contrib/libct/ftoc.c index fbf6af93bf..f8ee540190 100644 --- a/harbour/contrib/libct/ftoc.c +++ b/harbour/contrib/libct/ftoc.c @@ -51,10 +51,8 @@ * */ - #include "ct.h" - /* $DOC$ * $FUNCNAME$ * FTOC() @@ -94,15 +92,15 @@ HB_FUNC( FTOC ) { - union + union { double value; - char string[ sizeof( double )]; - } xConvert; + char string[sizeof( double )]; + } xConvert; - xConvert.value = hb_parnd( 1 ); + xConvert.value = hb_parnd( 1 ); - hb_retclen( xConvert.string, sizeof( double ) ); + hb_retclen( xConvert.string, sizeof( double ) ); } @@ -146,24 +144,17 @@ HB_FUNC( FTOC ) HB_FUNC( CTOF ) { - union + union { double value; - char string[ sizeof( double )]; - } xConvert; - char * pcString; - int i; + char string[sizeof( double )]; + } xConvert; - if (hb_parclen( 1 ) == sizeof( double )) - { - pcString = hb_parc( 1 ); - - for (i=0; i < (int) sizeof(double); i++) - xConvert.string[i] = pcString[i]; - - hb_retnd( xConvert.value ); - } - else - hb_retnd( 0.0 ); + if( hb_parclen( 1 ) >= sizeof( double ) ) + { + memcpy( xConvert.string, hb_parc( 1 ), sizeof( double ) ); + hb_retnd( xConvert.value ); + } + else + hb_retnd( 0.0 ); } - diff --git a/harbour/contrib/libct/invrtwin.prg b/harbour/contrib/libct/invrtwin.prg deleted file mode 100644 index b8bb0f31bc..0000000000 --- a/harbour/contrib/libct/invrtwin.prg +++ /dev/null @@ -1,119 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * CT3 video function: - INVERTWIN() - * - * Copyright 2002 Marek Horodyski - * www - http://www.harbour-project.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - */ - - -/* $DOC$ - * $FUNCNAME$ - * INVERTWIN() - * $CATEGORY$ - * CT3 video functions - * $ONELINER$ - * - * $SYNTAX$ - * - * $ARGUMENTS$ - * $RETURNS$ - * $DESCRIPTION$ - * TODO: add documentation - * $EXAMPLES$ - * $TESTS$ - * $STATUS$ - * Started - * $COMPLIANCE$ - * INVERTWIN() is compatible with CT3's INVERTWIN(). - * $PLATFORMS$ - * All - * $FILES$ - * Source is invertwin.prg, library is libct. - * $SEEALSO$ - * $END$ - */ - -Function INVERTWIN( t, l, b, r) - Static to_Konv := { ; - 0, 31,112, 32, 95, 66, 40, 97, 0, 73, 3, 0, 2, 0, 0, 2,; - 61, 0, 21, 44, 0, 0,110,111, 0, 75, 40, 0, 4, 48,122, 52,; - 82, 0,162, 0, 32, 32, 44, 9, 83, 9, 0, 82, 3, 23, 14, 0,; - 98, 0, 0, 7, 0, 32, 67, 32, 39,114, 0, 32, 32, 58, 32, 32,; - 111, 32, 2, 0, 34, 98, 0, 41, 55, 48, 13, 52, 31, 0, 4, 0,; - 255, 32, 49, 9, 21, 9, 8, 82, 10, 23, 32, 0, 48, 0, 50, 7,; - 49, 32, 74, 0, 78, 52,114, 41, 32, 0, 32, 32, 2, 32, 9, 32,; - 52, 45, 40, 32, 55, 0, 32, 68, 51, 32, 32, 0, 10, 44, 0, 53,; - 54,110,233, 53, 0, 0, 32, 52, 53, 0, 0, 49, 0, 9, 45, 0,; - 82, 32, 34, 0, 48, 0, 32, 48, 32, 32, 53, 51, 7, 45, 32, 32,; - 32, 32, 2, 51, 98, 32, 32, 13, 52, 19, 32, 45, 32, 53, 32, 49,; - 82, 45, 32, 56, 32, 0, 31, 50, 66, 32, 10, 32, 13, 32, 32, 32,; - 53,112, 66, 32, 0, 0, 0, 0, 0,110, 73, 0, 48, 52, 48, 0,; - 32, 9, 9, 82, 51, 0, 48, 7, 10, 32, 32, 10, 32, 18, 32, 0,; - 28, 13, 32, 32, 32, 53,112, 66, 32,114, 0, 0, 0, 0, 0,110,; - 73, 0, 48, 52, 48, 0, 32, 9, 9, 10, 32, 18, 0, 28, 13, 32} - Local n AS NUMERIC, c AS CHARACTER, stop AS NUMERIC - #ifdef HARBOUR - Local os := '' - #endif - t := If( ValType( t) == 'N', t, Row()) - l := If( ValType( l) == 'N', l, Col()) - b := If( ValType( b) == 'N', b, MaxCol()) - r := If( ValType( r) == 'N', r, MaxCol()) - c := SaveScreen( t, l, b, r) - stop := Len( c) - For n := 2 TO stop STEP 2 - #ifdef HARBOUR - os += c[ n - 1] + Chr( TO_Konv[ Asc( c[ n])]) - End - RestScreen( t, l, b, r, os) - #else // in xHarbour - c[ n] := Chr( TO_Konv[ Asc( c[ n])]) - End - RestScreen( t, l, b, r, c) - #endif - Return '' diff --git a/harbour/contrib/libct/makefile.bc b/harbour/contrib/libct/makefile.bc index 2429faa94c..a2b23f6f69 100644 --- a/harbour/contrib/libct/makefile.bc +++ b/harbour/contrib/libct/makefile.bc @@ -107,6 +107,7 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\charrepl.obj \ $(OBJ_DIR)\charsort.obj \ $(OBJ_DIR)\charswap.obj \ + $(OBJ_DIR)\color.obj \ $(OBJ_DIR)\count.obj \ $(OBJ_DIR)\ctc.obj \ $(OBJ_DIR)\ctmath.obj \ @@ -115,8 +116,13 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\ctstr.obj \ $(OBJ_DIR)\ctchksum.obj \ $(OBJ_DIR)\ctcrypt.obj \ + $(OBJ_DIR)\ctpad.obj \ + $(OBJ_DIR)\cttime.obj \ $(OBJ_DIR)\ctwfunc.obj \ $(OBJ_DIR)\ctwin.obj \ + $(OBJ_DIR)\datetime.obj \ + $(OBJ_DIR)\dattime2.obj \ + $(OBJ_DIR)\dbftools.obj \ $(OBJ_DIR)\exponent.obj \ $(OBJ_DIR)\files.obj \ $(OBJ_DIR)\finan.obj \ @@ -126,7 +132,6 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\misc1.obj \ $(OBJ_DIR)\num1.obj \ $(OBJ_DIR)\numat.obj \ - $(OBJ_DIR)\pad.obj \ $(OBJ_DIR)\pos1.obj \ $(OBJ_DIR)\pos2.obj \ $(OBJ_DIR)\posdiff.obj \ @@ -145,12 +150,8 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\wordrepl.obj \ $(OBJ_DIR)\wordtoch.obj \ \ - $(OBJ_DIR)\color.obj \ $(OBJ_DIR)\ct.obj \ $(OBJ_DIR)\ctmisc.obj \ - $(OBJ_DIR)\datetime.obj \ - $(OBJ_DIR)\dattime2.obj \ - $(OBJ_DIR)\invrtwin.obj \ $(OBJ_DIR)\numconv.obj \ $(OBJ_DIR)\screen2.obj \ $(OBJ_DIR)\setlast.obj \ @@ -240,6 +241,10 @@ $(OBJ_DIR)\charswap.obj : $(TOOLS_DIR)\charswap.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, +$(OBJ_DIR)\color.obj : $(OBJ_DIR)\color.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, + $(OBJ_DIR)\count.obj : $(TOOLS_DIR)\count.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, @@ -280,6 +285,26 @@ $(OBJ_DIR)\ctwin.obj : $(TOOLS_DIR)\ctwin.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, +$(OBJ_DIR)\ctpad.obj : $(TOOLS_DIR)\ctpad.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, + +$(OBJ_DIR)\cttime.obj : $(TOOLS_DIR)\cttime.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, + +$(OBJ_DIR)\datetime.obj : $(OBJ_DIR)\datetime.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, + +$(OBJ_DIR)\dattime2.obj : $(OBJ_DIR)\dattime2.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, + +$(OBJ_DIR)\dbftools.obj : $(OBJ_DIR)\dbftools.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, + $(OBJ_DIR)\exponent.obj : $(TOOLS_DIR)\exponent.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, @@ -316,10 +341,6 @@ $(OBJ_DIR)\numat.obj : $(TOOLS_DIR)\numat.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, -$(OBJ_DIR)\pad.obj : $(TOOLS_DIR)\pad.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - $(OBJ_DIR)\pos1.obj : $(TOOLS_DIR)\pos1.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, @@ -395,13 +416,6 @@ $(OBJ_DIR)\ct.obj : $(OBJ_DIR)\ct.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, -$(OBJ_DIR)\color.c : $(TOOLS_DIR)\color.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\color.obj : $(OBJ_DIR)\color.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - $(OBJ_DIR)\ctmisc.c : $(TOOLS_DIR)\ctmisc.prg $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ @@ -409,27 +423,6 @@ $(OBJ_DIR)\ctmisc.obj : $(OBJ_DIR)\ctmisc.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, -$(OBJ_DIR)\datetime.c : $(TOOLS_DIR)\datetime.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\datetime.obj : $(OBJ_DIR)\datetime.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\dattime2.c : $(TOOLS_DIR)\dattime2.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\dattime2.obj : $(OBJ_DIR)\dattime2.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - -$(OBJ_DIR)\invrtwin.c : $(TOOLS_DIR)\invrtwin.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\invrtwin.obj : $(OBJ_DIR)\invrtwin.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, - $(OBJ_DIR)\numconv.c : $(TOOLS_DIR)\numconv.prg $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ diff --git a/harbour/contrib/libct/makefile.vc b/harbour/contrib/libct/makefile.vc index 44389a4db5..f040402dec 100644 --- a/harbour/contrib/libct/makefile.vc +++ b/harbour/contrib/libct/makefile.vc @@ -127,6 +127,7 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\charrepl.obj \ $(OBJ_DIR)\charsort.obj \ $(OBJ_DIR)\charswap.obj \ + $(OBJ_DIR)\color.obj \ $(OBJ_DIR)\count.obj \ $(OBJ_DIR)\ctc.obj \ $(OBJ_DIR)\ctmath.obj \ @@ -135,6 +136,11 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\ctstr.obj \ $(OBJ_DIR)\ctchksum.obj \ $(OBJ_DIR)\ctcrypt.obj \ + $(OBJ_DIR)\ctpad.obj \ + $(OBJ_DIR)\cttime.obj \ + $(OBJ_DIR)\datetime.obj \ + $(OBJ_DIR)\dattime2.obj \ + $(OBJ_DIR)\dbftools.obj \ $(OBJ_DIR)\exponent.obj \ $(OBJ_DIR)\finan.obj \ $(OBJ_DIR)\ftoc.obj \ @@ -143,7 +149,6 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\misc1.obj \ $(OBJ_DIR)\num1.obj \ $(OBJ_DIR)\numat.obj \ - $(OBJ_DIR)\pad.obj \ $(OBJ_DIR)\pos1.obj \ $(OBJ_DIR)\pos2.obj \ $(OBJ_DIR)\posdiff.obj \ @@ -162,12 +167,8 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\wordrepl.obj \ $(OBJ_DIR)\wordtoch.obj \ \ - $(OBJ_DIR)\color.obj \ $(OBJ_DIR)\ct.obj \ $(OBJ_DIR)\ctmisc.obj \ - $(OBJ_DIR)\datetime.obj \ - $(OBJ_DIR)\dattime2.obj \ - $(OBJ_DIR)\invertwin.obj \ $(OBJ_DIR)\numconv.obj \ $(OBJ_DIR)\screen2.obj \ $(OBJ_DIR)\setlast.obj \ @@ -198,6 +199,7 @@ CLEAN: -@if exist $(OBJ_DIR)\charrepl.* del $(OBJ_DIR)\charrepl.* -@if exist $(OBJ_DIR)\charsort.* del $(OBJ_DIR)\charsort.* -@if exist $(OBJ_DIR)\charswap.* del $(OBJ_DIR)\charswap.* + -@if exist $(OBJ_DIR)\color.* del $(OBJ_DIR)\color.* -@if exist $(OBJ_DIR)\count.* del $(OBJ_DIR)\count.* -@if exist $(OBJ_DIR)\ctc.* del $(OBJ_DIR)\ctc.* -@if exist $(OBJ_DIR)\ctmath.* del $(OBJ_DIR)\ctmath.* @@ -206,6 +208,11 @@ CLEAN: -@if exist $(OBJ_DIR)\ctstr.* del $(OBJ_DIR)\ctstr.* -@if exist $(OBJ_DIR)\ctchksum.* del $(OBJ_DIR)\ctchksum.* -@if exist $(OBJ_DIR)\ctcrypt.* del $(OBJ_DIR)\ctcrypt.* + -@if exist $(OBJ_DIR)\cttime.* del $(OBJ_DIR)\cttime.* + -@if exist $(OBJ_DIR)\ctpad.* del $(OBJ_DIR)\ctpad.* + -@if exist $(OBJ_DIR)\datetime.* del $(OBJ_DIR)\datetime.* + -@if exist $(OBJ_DIR)\dattime2.* del $(OBJ_DIR)\dattime2.* + -@if exist $(OBJ_DIR)\dbftools.* del $(OBJ_DIR)\dbftools.* -@if exist $(OBJ_DIR)\exponent.* del $(OBJ_DIR)\exponent.* -@if exist $(OBJ_DIR)\finan.* del $(OBJ_DIR)\finan.* -@if exist $(OBJ_DIR)\ftoc.* del $(OBJ_DIR)\ftoc.* @@ -213,7 +220,6 @@ CLEAN: -@if exist $(OBJ_DIR)\misc1.* del $(OBJ_DIR)\misc1.* -@if exist $(OBJ_DIR)\num1.* del $(OBJ_DIR)\num1.* -@if exist $(OBJ_DIR)\numat.* del $(OBJ_DIR)\numat.* - -@if exist $(OBJ_DIR)\pad.* del $(OBJ_DIR)\pad.* -@if exist $(OBJ_DIR)\pos1.* del $(OBJ_DIR)\pos1.* -@if exist $(OBJ_DIR)\pos2.* del $(OBJ_DIR)\pos2.* -@if exist $(OBJ_DIR)\posdiff.* del $(OBJ_DIR)\posdiff.* @@ -230,12 +236,8 @@ CLEAN: -@if exist $(OBJ_DIR)\trig.* del $(OBJ_DIR)\trig.* -@if exist $(OBJ_DIR)\wordrepl.* del $(OBJ_DIR)\wordrepl.* -@if exist $(OBJ_DIR)\wordtoch.* del $(OBJ_DIR)\wordtoch.* - -@if exist $(OBJ_DIR)\color.* del $(OBJ_DIR)\color.* -@if exist $(OBJ_DIR)\ct.* del $(OBJ_DIR)\ct.* -@if exist $(OBJ_DIR)\ctmisc.* del $(OBJ_DIR)\ctmisc.* - -@if exist $(OBJ_DIR)\datetime.* del $(OBJ_DIR)\datetime.* - -@if exist $(OBJ_DIR)\dattime2.* del $(OBJ_DIR)\dattime2.* - -@if exist $(OBJ_DIR)\invertwin.* del $(OBJ_DIR)\invertwin.* -@if exist $(OBJ_DIR)\numconv.* del $(OBJ_DIR)\numconv.* -@if exist $(OBJ_DIR)\screen2.* del $(OBJ_DIR)\screen2.* -@if exist $(OBJ_DIR)\setlast.* del $(OBJ_DIR)\setlast.* diff --git a/harbour/source/rtl/gttrm/gttrm.c b/harbour/source/rtl/gttrm/gttrm.c index 7a2a10d1da..bbdcde4c66 100644 --- a/harbour/source/rtl/gttrm/gttrm.c +++ b/harbour/source/rtl/gttrm/gttrm.c @@ -3036,6 +3036,7 @@ static void hb_gt_trm_Redraw( int iRow, int iCol, int iSize ) if( !hb_gt_GetScrChar( iRow, iCol + iLen, &bColor, &bAttr, &usChar ) ) break; + usChar &= 0xff; if( bAttr & HB_GT_ATTR_BOX ) { iColor = bColor | ( s_termState.boxattr[ usChar ] & ~HB_GTTRM_ATTR_CHAR ); diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index eb4f0fb0d9..7b8458631e 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -352,6 +352,38 @@ static int hb_gt_def_ColorNum( const char * szColorString ) case 'W': nColor |= bFore ? 0x07: 0x70; break; + + case 'N': + nColor &= bFore ? 0xF8: 0x8F; + break; + + case 'I': + nColor |= 0x70; + break; + + case 'U': + nColor |= 0x01; + break; + + case ' ': + break; + + case ',': + return nColor; + + default: + if( c >= '0' && c <= '9' && + ( nColor & ( bFore ? 0xFF : 0xF0 ) ) == 0 ) + { + int iColor = c - '0'; + while( *szColorString >= '0' && *szColorString <= '9' ) + iColor = iColor * 10 + ( *szColorString++ - '0' ); + if( !bFore ) + iColor <<= 4; + nColor |= iColor & 0xff; + } + else + return 0; } } @@ -498,7 +530,7 @@ static void hb_gt_def_StringToColors( const char * szColorString, int ** pColors nFore &= 0x888F; } } - if( ( nFore & 0x8800 ) != 0 && ( ( nFore | nColor ) & 0x0077 ) == 0) + if( ( nFore & 0x8800 ) != 0 && ( ( nFore | nColor ) & 0x0077 ) == 0 ) nFore |= 1; if( bSlash )