2007-07-19 20:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/libct/Makefile
+ harbour/contrib/libct/maxline.c
+ harbour/contrib/libct/lton.c
+ harbour/contrib/libct/pack.c
* harbour/contrib/libct/color.c
* harbour/contrib/libct/makefile.bc
* harbour/contrib/libct/screen1.c
- harbour/contrib/libct/screen2.prg
* harbour/contrib/libct/makefile.vc
* harbour/source/rtl/gtapi.c
* synced with xHarbour modifications and fixes
* new functions or .prg functions rewritten in C
! some fixes
* indenting
This commit is contained in:
@@ -8,6 +8,22 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-07-19 20:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/contrib/libct/Makefile
|
||||
+ harbour/contrib/libct/maxline.c
|
||||
+ harbour/contrib/libct/lton.c
|
||||
+ harbour/contrib/libct/pack.c
|
||||
* harbour/contrib/libct/color.c
|
||||
* harbour/contrib/libct/makefile.bc
|
||||
* harbour/contrib/libct/screen1.c
|
||||
- harbour/contrib/libct/screen2.prg
|
||||
* harbour/contrib/libct/makefile.vc
|
||||
* harbour/source/rtl/gtapi.c
|
||||
* synced with xHarbour modifications and fixes
|
||||
* new functions or .prg functions rewritten in C
|
||||
! some fixes
|
||||
* indenting
|
||||
|
||||
2007-07-19 18:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/contrib/libct/strdiff.c
|
||||
* harbour/contrib/libct/token2.c
|
||||
|
||||
@@ -46,6 +46,8 @@ C_SOURCES = \
|
||||
justify.c \
|
||||
keyset.c \
|
||||
like.c \
|
||||
lton.c \
|
||||
maxline.c \
|
||||
misc1.c \
|
||||
misc2.c \
|
||||
misc3.c \
|
||||
@@ -53,6 +55,7 @@ C_SOURCES = \
|
||||
numat.c \
|
||||
numcount.c \
|
||||
numline.c \
|
||||
pack.c \
|
||||
pos1.c \
|
||||
pos2.c \
|
||||
posdiff.c \
|
||||
@@ -77,7 +80,6 @@ PRG_SOURCES= \
|
||||
ctmisc.prg \
|
||||
cttime.prg \
|
||||
numconv.prg \
|
||||
screen2.prg \
|
||||
|
||||
LIBNAME=ct
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ HB_FUNC( INVERTWIN )
|
||||
iBottom = ISNUM( 3 ) ? hb_parni( 3 ) : hb_gtMaxRow();
|
||||
iRight = ISNUM( 4 ) ? hb_parni( 4 ) : hb_gtMaxCol();
|
||||
|
||||
hb_gtBeginWrite();
|
||||
while( iTop <= iBottom )
|
||||
{
|
||||
int iCol = iLeft;
|
||||
@@ -147,6 +148,7 @@ HB_FUNC( INVERTWIN )
|
||||
}
|
||||
++iTop;
|
||||
}
|
||||
hb_gtEndWrite();
|
||||
}
|
||||
|
||||
|
||||
|
||||
59
harbour/contrib/libct/lton.c
Normal file
59
harbour/contrib/libct/lton.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* xHarbour Project source code:
|
||||
* CT3 numeric functions
|
||||
*
|
||||
* LTON()
|
||||
* Copyright 2004 Pavel Tsarenko <tpe2.mail.ru>
|
||||
* www - http://www.xharbour.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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
HB_FUNC( LTON )
|
||||
{
|
||||
hb_retni( ISLOG( 1 ) && hb_parl( 1 ) ? 1 : 0 );
|
||||
}
|
||||
@@ -129,6 +129,8 @@ TOOLS_LIB_OBJS = \
|
||||
$(OBJ_DIR)\justify.obj \
|
||||
$(OBJ_DIR)\keyset.obj \
|
||||
$(OBJ_DIR)\like.obj \
|
||||
$(OBJ_DIR)\lton.obj \
|
||||
$(OBJ_DIR)\maxline.obj \
|
||||
$(OBJ_DIR)\misc1.obj \
|
||||
$(OBJ_DIR)\misc2.obj \
|
||||
$(OBJ_DIR)\misc3.obj \
|
||||
@@ -136,6 +138,7 @@ TOOLS_LIB_OBJS = \
|
||||
$(OBJ_DIR)\numat.obj \
|
||||
$(OBJ_DIR)\numcount.obj \
|
||||
$(OBJ_DIR)\numline.obj \
|
||||
$(OBJ_DIR)\pack.obj \
|
||||
$(OBJ_DIR)\pos1.obj \
|
||||
$(OBJ_DIR)\pos2.obj \
|
||||
$(OBJ_DIR)\posdiff.obj \
|
||||
@@ -159,7 +162,6 @@ TOOLS_LIB_OBJS = \
|
||||
$(OBJ_DIR)\ctmisc.obj \
|
||||
$(OBJ_DIR)\cttime.obj \
|
||||
$(OBJ_DIR)\numconv.obj \
|
||||
$(OBJ_DIR)\screen2.obj \
|
||||
|
||||
#
|
||||
# Our default target
|
||||
@@ -334,6 +336,14 @@ $(OBJ_DIR)\like.obj : $(TOOLS_DIR)\like.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\lton.obj : $(TOOLS_DIR)\lton.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\maxline.obj : $(TOOLS_DIR)\maxline.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\misc1.obj : $(TOOLS_DIR)\misc1.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
@@ -362,6 +372,10 @@ $(OBJ_DIR)\numline.obj : $(TOOLS_DIR)\numline.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\pack.obj : $(TOOLS_DIR)\pack.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\pos1.obj : $(TOOLS_DIR)\pos1.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
@@ -461,10 +475,3 @@ $(OBJ_DIR)\numconv.c : $(TOOLS_DIR)\numconv.prg
|
||||
$(OBJ_DIR)\numconv.obj : $(OBJ_DIR)\numconv.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\screen2.c : $(TOOLS_DIR)\screen2.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
|
||||
|
||||
$(OBJ_DIR)\screen2.obj : $(OBJ_DIR)\screen2.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
@@ -147,6 +147,8 @@ TOOLS_LIB_OBJS = \
|
||||
$(OBJ_DIR)\justify.obj \
|
||||
$(OBJ_DIR)\keyset.obj \
|
||||
$(OBJ_DIR)\like.obj \
|
||||
$(OBJ_DIR)\lton.obj \
|
||||
$(OBJ_DIR)\maxline.obj \
|
||||
$(OBJ_DIR)\misc1.obj \
|
||||
$(OBJ_DIR)\misc2.obj \
|
||||
$(OBJ_DIR)\misc3.obj \
|
||||
@@ -154,6 +156,7 @@ TOOLS_LIB_OBJS = \
|
||||
$(OBJ_DIR)\numat.obj \
|
||||
$(OBJ_DIR)\numcount.obj \
|
||||
$(OBJ_DIR)\numline.obj \
|
||||
$(OBJ_DIR)\pack.obj \
|
||||
$(OBJ_DIR)\pos1.obj \
|
||||
$(OBJ_DIR)\pos2.obj \
|
||||
$(OBJ_DIR)\posdiff.obj \
|
||||
@@ -176,7 +179,6 @@ TOOLS_LIB_OBJS = \
|
||||
$(OBJ_DIR)\ct.obj \
|
||||
$(OBJ_DIR)\ctmisc.obj \
|
||||
$(OBJ_DIR)\numconv.obj \
|
||||
$(OBJ_DIR)\screen2.obj \
|
||||
|
||||
#
|
||||
# Our default target
|
||||
@@ -223,6 +225,8 @@ CLEAN:
|
||||
-@if exist $(OBJ_DIR)\ftoc.* del $(OBJ_DIR)\ftoc.*
|
||||
-@if exist $(OBJ_DIR)\justify.* del $(OBJ_DIR)\justify.*
|
||||
-@if exist $(OBJ_DIR)\like.* del $(OBJ_DIR)\like.*
|
||||
-@if exist $(OBJ_DIR)\lton.* del $(OBJ_DIR)\lton.*
|
||||
-@if exist $(OBJ_DIR)\maxline.* del $(OBJ_DIR)\maxline.*
|
||||
-@if exist $(OBJ_DIR)\misc1.* del $(OBJ_DIR)\misc1.*
|
||||
-@if exist $(OBJ_DIR)\misc2.* del $(OBJ_DIR)\misc2.*
|
||||
-@if exist $(OBJ_DIR)\misc3.* del $(OBJ_DIR)\misc3.*
|
||||
@@ -230,6 +234,7 @@ CLEAN:
|
||||
-@if exist $(OBJ_DIR)\numat.* del $(OBJ_DIR)\numat.*
|
||||
-@if exist $(OBJ_DIR)\numcount.* del $(OBJ_DIR)\numcount.*
|
||||
-@if exist $(OBJ_DIR)\numline.* del $(OBJ_DIR)\numline.*
|
||||
-@if exist $(OBJ_DIR)\pack.* del $(OBJ_DIR)\pack.*
|
||||
-@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.*
|
||||
@@ -250,7 +255,6 @@ CLEAN:
|
||||
-@if exist $(OBJ_DIR)\ct.* del $(OBJ_DIR)\ct.*
|
||||
-@if exist $(OBJ_DIR)\ctmisc.* del $(OBJ_DIR)\ctmisc.*
|
||||
-@if exist $(OBJ_DIR)\numconv.* del $(OBJ_DIR)\numconv.*
|
||||
-@if exist $(OBJ_DIR)\screen2.* del $(OBJ_DIR)\screen2.*
|
||||
-@if exist $(TOOLS_LIB) del $(TOOLS_LIB)
|
||||
|
||||
#
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* CT3 video functions (screen-like functions): - SCREENMIX()
|
||||
*
|
||||
* Copyright 1999-2001 Viktor Szakats <viktor.szakats@syenar.hu>:
|
||||
* www - http://www.harbour-project.org
|
||||
* xHarbour Project source code:
|
||||
* CT3 numeric functions
|
||||
*
|
||||
* MAXLINE()
|
||||
* Copyright 2004 Pavel Tsarenko <tpe2.mail.ru>
|
||||
* www - http://www.xharbour.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
|
||||
@@ -50,40 +51,33 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "color.ch"
|
||||
#include "common.ch"
|
||||
#include "hbapi.h"
|
||||
|
||||
/* $DOC$
|
||||
* $FUNCNAME$
|
||||
* SCREENMIX()
|
||||
* $CATEGORY$
|
||||
* CT3 video functions
|
||||
* $ONELINER$
|
||||
* $SYNTAX$
|
||||
* SCREENMIX (<cCharString>, <cAttributeString>, [<nRow>], [<nCol>]) -> <cEmptyString>
|
||||
* $ARGUMENTS$
|
||||
* $RETURNS$
|
||||
* $DESCRIPTION$
|
||||
* TODO: add documentation
|
||||
* $EXAMPLES$
|
||||
* $TESTS$
|
||||
* $STATUS$
|
||||
* Started
|
||||
* $COMPLIANCE$
|
||||
* $PLATFORMS$
|
||||
* All
|
||||
* $FILES$
|
||||
* Source is screen2.prg, library is libct.
|
||||
* $SEEALSO$
|
||||
* $END$
|
||||
*/
|
||||
HB_FUNC( MAXLINE )
|
||||
{
|
||||
LONG lLength = 0;
|
||||
|
||||
FUNCTION SCREENMIX( c, a, row, col )
|
||||
if( ISCHAR( 1 ) )
|
||||
{
|
||||
char *pcString = hb_parc( 1 );
|
||||
char *pBuffer;
|
||||
LONG lStrLen = hb_parclen( 1 );
|
||||
|
||||
DEFAULT row TO Row()
|
||||
DEFAULT col TO Col()
|
||||
while( lStrLen > 0 )
|
||||
{
|
||||
pBuffer = ( char * ) memchr( pcString, 13, lStrLen );
|
||||
if( !pBuffer )
|
||||
pBuffer = pcString + lStrLen;
|
||||
|
||||
RestScreen( row, col, row, col + Len( a ) - 1, CHARMIX( c, a ) )
|
||||
|
||||
RETURN ""
|
||||
if( pBuffer - pcString > lLength )
|
||||
lLength = pBuffer - pcString;
|
||||
|
||||
pBuffer++;
|
||||
if( *pBuffer == 10 )
|
||||
pBuffer++;
|
||||
lStrLen -= pBuffer - pcString;
|
||||
pcString = pBuffer;
|
||||
}
|
||||
}
|
||||
hb_retnl( lLength );
|
||||
}
|
||||
138
harbour/contrib/libct/pack.c
Normal file
138
harbour/contrib/libct/pack.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* xHarbour Project source code:
|
||||
* CT3 CHARPACK() and CHARUNPACK() functions.
|
||||
*
|
||||
* Copyright 2004 Phil Krylov <phil@newstar.rinet.ru>
|
||||
* www - http://www.xharbour.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.
|
||||
*
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
|
||||
HB_FUNC( CHARPACK )
|
||||
{
|
||||
unsigned len = hb_parclen( 1 );
|
||||
unsigned char *in = ( unsigned char * ) hb_parcx( 1 );
|
||||
|
||||
if( hb_parni( 2 ) == 0 )
|
||||
{
|
||||
unsigned char *out = ( unsigned char * ) hb_xgrab( len * 3 + 2 );
|
||||
unsigned n_in = 0, n_out = 0;
|
||||
|
||||
out[n_out++] = 158;
|
||||
out[n_out++] = 158;
|
||||
|
||||
while( n_in < len )
|
||||
{
|
||||
int n_count = 1, n_max = HB_MIN( 255, len - n_in );
|
||||
unsigned char c = in[n_in];
|
||||
|
||||
while( n_count < n_max && in[n_in + n_count] == c )
|
||||
n_count++;
|
||||
out[n_out++] = 0;
|
||||
out[n_out++] = n_count;
|
||||
out[n_out++] = c;
|
||||
n_in += n_count;
|
||||
}
|
||||
if( n_out < len )
|
||||
hb_retclen( ( char * ) out, n_out );
|
||||
hb_xfree( out );
|
||||
if( n_out < len )
|
||||
return;
|
||||
}
|
||||
hb_retclen( ( char * ) in, len );
|
||||
}
|
||||
|
||||
|
||||
static unsigned char *buf_append( unsigned char *buf, unsigned *buf_size, unsigned count,
|
||||
unsigned char c, unsigned *buf_len )
|
||||
{
|
||||
if( *buf_len + count > *buf_size )
|
||||
{
|
||||
*buf_size = HB_MAX( *buf_len + count, *buf_size + 32768 );
|
||||
buf = ( unsigned char * ) hb_xrealloc( buf, *buf_size );
|
||||
}
|
||||
memset( buf + *buf_len, c, count );
|
||||
*buf_len += count;
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
HB_FUNC( CHARUNPACK )
|
||||
{
|
||||
unsigned buf_size = 32768;
|
||||
unsigned len = hb_parclen( 1 );
|
||||
unsigned out_len = 0;
|
||||
unsigned char *in = ( unsigned char * ) hb_parcx( 1 );
|
||||
unsigned char *out;
|
||||
unsigned i;
|
||||
|
||||
if( hb_parni( 2 ) == 0 )
|
||||
{
|
||||
if( !( in[0] == 158 && in[1] == 158 ) )
|
||||
{
|
||||
hb_retclen( ( char * ) in, len );
|
||||
return;
|
||||
}
|
||||
out = ( unsigned char * ) hb_xgrab( buf_size );
|
||||
for( i = 2; i <= len - 3; i += 3 )
|
||||
{
|
||||
if( in[i] != 0 )
|
||||
{
|
||||
hb_xfree( out );
|
||||
hb_retclen( ( char * ) in, len );
|
||||
return;
|
||||
}
|
||||
out = buf_append( out, &buf_size, in[i + 1], in[i + 2], &out_len );
|
||||
}
|
||||
hb_retclen( ( char * ) out, out_len );
|
||||
hb_xfree( out );
|
||||
return;
|
||||
}
|
||||
hb_retclen( ( char * ) in, len );
|
||||
}
|
||||
@@ -6,10 +6,8 @@
|
||||
* Harbour Project source code:
|
||||
* CT3 video functions:
|
||||
*
|
||||
* SCREENATTR()
|
||||
* Copyright 2002 Walter Negro <anegro@overnet.com.ar>
|
||||
* SCREENATTR(), SCREENMIX(), SAYSCREEN(), CLEARWIN()
|
||||
*
|
||||
* CLEARWIN()
|
||||
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
*
|
||||
* www - http://www.harbour-project.org
|
||||
@@ -108,12 +106,123 @@ HB_FUNC( SCREENATTR )
|
||||
iRow = ISNUM( 1 ) ? hb_parni( 1 ) : sRow;
|
||||
iCol = ISNUM( 2 ) ? hb_parni( 2 ) : sCol;
|
||||
|
||||
if( ! hb_gtGetChar( iRow, iCol, &bColor, &bAttr, &usChar ) )
|
||||
if( hb_gtGetChar( iRow, iCol, &bColor, &bAttr, &usChar ) != SUCCESS )
|
||||
bColor = 0;
|
||||
|
||||
hb_retni( ( int ) bColor );
|
||||
}
|
||||
|
||||
/* $DOC$
|
||||
* $FUNCNAME$
|
||||
* SCREENMIX()
|
||||
* $CATEGORY$
|
||||
* CT3 video functions
|
||||
* $ONELINER$
|
||||
* $SYNTAX$
|
||||
* SCREENMIX (<cCharString>, <cAttributeString>, [<nRow>], [<nCol>]) -> <cEmptyString>
|
||||
* $ARGUMENTS$
|
||||
* $RETURNS$
|
||||
* $DESCRIPTION$
|
||||
* TODO: add documentation
|
||||
* $EXAMPLES$
|
||||
* $TESTS$
|
||||
* $STATUS$
|
||||
* Started
|
||||
* $COMPLIANCE$
|
||||
* $PLATFORMS$
|
||||
* All
|
||||
* $FILES$
|
||||
* Source is screen2.prg, library is libct.
|
||||
* $SEEALSO$
|
||||
* $END$
|
||||
*/
|
||||
|
||||
HB_FUNC( SCREENMIX )
|
||||
{
|
||||
ULONG ulLen = hb_parclen( 1 );
|
||||
|
||||
if( ulLen )
|
||||
{
|
||||
char * szText = hb_parc( 1 ), * szAttr;
|
||||
ULONG ulAttr = hb_parclen( 2 ), ul = 0;
|
||||
SHORT sRow, sCol;
|
||||
int iRow, iCol, i;
|
||||
|
||||
if( ulAttr == 0 )
|
||||
{
|
||||
szAttr = " ";
|
||||
ulAttr = 1;
|
||||
}
|
||||
else
|
||||
szAttr = hb_parc( 2 );
|
||||
|
||||
hb_gtGetPos( &sRow, &sCol );
|
||||
iRow = ISNUM( 3 ) ? hb_parni( 3 ) : sRow;
|
||||
iCol = ISNUM( 4 ) ? hb_parni( 4 ) : sCol;
|
||||
|
||||
if( iRow >= 0 && iCol >= 0 &&
|
||||
iRow <= hb_gtMaxRow() && iCol <= hb_gtMaxCol() )
|
||||
{
|
||||
hb_gtBeginWrite();
|
||||
i = iCol;
|
||||
do
|
||||
{
|
||||
if( hb_gtPutChar( iRow, i++, szAttr[ ul ], 0, *szText++ ) != SUCCESS )
|
||||
{
|
||||
if( ++iRow > hb_gtMaxRow() )
|
||||
break;
|
||||
--szText;
|
||||
++ulLen;
|
||||
i = iCol;
|
||||
}
|
||||
else if( ++ul == ulAttr )
|
||||
ul = 0;
|
||||
}
|
||||
while( --ulLen );
|
||||
hb_gtEndWrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HB_FUNC( SAYSCREEN )
|
||||
{
|
||||
ULONG ulLen = hb_parclen( 1 );
|
||||
|
||||
if( ulLen )
|
||||
{
|
||||
char * szText = hb_parc( 1 );
|
||||
SHORT sRow, sCol;
|
||||
int iRow, iCol, i;
|
||||
|
||||
hb_gtGetPos( &sRow, &sCol );
|
||||
iRow = ISNUM( 2 ) ? hb_parni( 2 ) : sRow;
|
||||
iCol = ISNUM( 3 ) ? hb_parni( 3 ) : sCol;
|
||||
|
||||
if( iRow >= 0 && iCol >= 0 &&
|
||||
iRow <= hb_gtMaxRow() && iCol <= hb_gtMaxCol() )
|
||||
{
|
||||
hb_gtBeginWrite();
|
||||
i = iCol;
|
||||
do
|
||||
{
|
||||
BYTE bColor, bAttr;
|
||||
USHORT usChar;
|
||||
if( hb_gtGetChar( iRow, i, &bColor, &bAttr, &usChar ) != SUCCESS )
|
||||
{
|
||||
if( ++iRow > hb_gtMaxRow() )
|
||||
break;
|
||||
++ulLen;
|
||||
i = iCol;
|
||||
}
|
||||
else
|
||||
hb_gtPutChar( iRow, i++, bColor, bAttr, *szText++ );
|
||||
}
|
||||
while( --ulLen );
|
||||
hb_gtEndWrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HB_FUNC( CLEARWIN )
|
||||
{
|
||||
int iMaxRow = hb_gtMaxRow();
|
||||
|
||||
@@ -393,18 +393,16 @@ HB_EXPORT ERRCODE hb_gtGetChar( USHORT uiRow, USHORT uiCol, BYTE * pbColor, BYTE
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gtGetChar(%hu, %hu, %p, %p, %p)", uiRow, uiCol, pbColor, pbAttr, pusChar));
|
||||
|
||||
hb_gt_GetChar( uiRow, uiCol, pbColor, pbAttr, pusChar );
|
||||
|
||||
return SUCCESS;
|
||||
return hb_gt_GetChar( uiRow, uiCol, pbColor, pbAttr, pusChar ) ?
|
||||
SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
HB_EXPORT ERRCODE hb_gtPutChar( USHORT uiRow, USHORT uiCol, BYTE bColor, BYTE bAttr, USHORT usChar )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gtPutChar(%hu, %hu, %hu, %hu, %hu)", uiRow, uiCol, bColor, bAttr, usChar));
|
||||
|
||||
hb_gt_PutChar( uiRow, uiCol, bColor, bAttr, usChar );
|
||||
|
||||
return SUCCESS;
|
||||
return hb_gt_PutChar( uiRow, uiCol, bColor, bAttr, usChar ) ?
|
||||
SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
HB_EXPORT ERRCODE hb_gtBeginWrite( void )
|
||||
|
||||
Reference in New Issue
Block a user