2010-01-05 14:03 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/hbct/video.c
    % use hb_gtColorToN() function instead of own code to decode Clipper
      color in VGAPALETTE()
    ! added protection against possible transfer buffer overflow in
      SETFONT() function
    ! return -2 when SETFONT() is not implemented

    TODO: clean these functions, add support for other DOS compilers,
          add some missing functions and redirect few of them like
          VGAPALETTE() to hb_gtInfo() in non DOS builds

  * harbour/src/rtl/hbgtcore.c
    ! fixed missing ';' => CHR( 13 ) translation in __KEYBOARD() function
      [TOMERGE 2.0]
This commit is contained in:
Przemyslaw Czerpak
2010-01-05 13:03:37 +00:00
parent 24e67cf403
commit c02e6f1616
3 changed files with 38 additions and 56 deletions

View File

@@ -17,6 +17,22 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-05 14:03 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbct/video.c
% use hb_gtColorToN() function instead of own code to decode Clipper
color in VGAPALETTE()
! added protection against possible transfer buffer overflow in
SETFONT() function
! return -2 when SETFONT() is not implemented
TODO: clean these functions, add support for other DOS compilers,
add some missing functions and redirect few of them like
VGAPALETTE() to hb_gtInfo() in non DOS builds
* harbour/src/rtl/hbgtcore.c
! fixed missing ';' => CHR( 13 ) translation in __KEYBOARD() function
[TOMERGE 2.0]
2010-01-05 02:59 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbxbp/xbpmenubar.prg
* contrib/hbxbp/xbptoolbar.prg

View File

@@ -57,6 +57,7 @@
*/
#include "hbapi.h"
#include "hbapigt.h"
#if defined( HB_OS_DOS )
@@ -147,7 +148,7 @@ HB_FUNC( VGAPALETTE )
{
const char *color_string;
char red, green, blue;
char attr = 0;
char attr;
if( hb_pcount() < 4 )
{
@@ -155,57 +156,16 @@ HB_FUNC( VGAPALETTE )
hb_retl( FALSE );
return;
}
if( HB_ISNUM( 1 ) && hb_parni( 1 ) < 16 )
{
attr = hb_parni( 1 );
}
else if( HB_ISCHAR( 1 ) )
{
const char *s;
color_string = hb_parcx( 1 );
for( s = color_string; *s; s++ )
{
switch ( *s )
{
case 'N':
case 'n':
attr |= 0;
break;
case 'B':
case 'b':
attr |= 1;
break;
case 'G':
case 'g':
attr |= 2;
break;
case 'R':
case 'r':
attr |= 4;
break;
case 'W':
case 'w':
attr |= 7;
break;
case '+':
attr |= 8;
break;
case 'U':
case 'u':
case 'I':
case 'i':
case 'X':
case 'x':
/* these seem to be used only in mono */
break;
default:
hb_retl( FALSE );
return;
}
}
}
color_string = hb_parc( 1 );
if( color_string )
attr = hb_gtColorToN( color_string );
else if( HB_ISNUM( 1 ) )
attr = hb_parni( 1 );
else
attr = -1;
if( attr < 0 || attr >= 16 )
{
/* An invalid argument */
hb_retl( FALSE );
@@ -352,9 +312,8 @@ HB_FUNC( SETFONT )
offset = hb_parni( 3 );
if( HB_ISNUM( 4 ) )
count = hb_parni( 4 );
if( HB_ISLOG( 3 ) )
if( hb_parl( 3 ) && count != 0 )
height = len / count;
if( HB_ISLOG( 3 ) && hb_parl( 3 ) && count != 0 )
height = len / count;
# ifdef __DJGPP__
{
@@ -367,12 +326,13 @@ HB_FUNC( SETFONT )
r.x.dx = offset;
r.x.es = __tb >> 4;
r.x.bp = __tb & 0xF;
dosmemput( font, len, __tb );
dosmemput( font, HB_MIN( len, __tb_size ), __tb );
__dpmi_int( 0x10, &r );
hb_retni( 0 );
}
# else
hb_retni( -2 );
# endif
hb_retni( 0 );
}
#endif /* HB_OS_DOS */

View File

@@ -2524,6 +2524,12 @@ static void hb_gt_def_InkeySetText( PHB_GT pGT, const char * szText, ULONG ulLen
memcpy( pGT->StrBuffer, szText, ulLen );
pGT->StrBufferSize = ulLen;
pGT->StrBufferPos = 0;
do
{
if( pGT->StrBuffer[ --ulLen ] == ';' )
pGT->StrBuffer[ ulLen ] = HB_CHAR_CR;
}
while( ulLen );
}
}