2012-10-18 20:59 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbmisc/hb_f.c
! fixed clang warning
* contrib/hbzebra/datamtrx.c
! applied patch from Mindaugas, fixing literal truncation
warning on MSVC. Thank you.
* include/harbour.hbx
* src/rtl/mouse53.c
+ added HB_MGETBOUNDS( /* @ */ nTop, /* @ */ nLeft, /* @ */ nBotton, /* @ */ nRight ) -> NIL
* contrib/hbnf/hbnf.hbx
* contrib/hbnf/mouse.c
* contrib/hbnf/mouse1.prg
* all possible MS-DOS specific mouse handling
functions rewritten in Harbour using core mouse API.
Now the included sample more or less work.
There are still two important functions (FT_MBUT*())
that are MS-DOS specific and don't work. Have no
idea yet how to rewrite these in multiplatform way,
they work in very MS-DOS specific way.
! fixed few bugs along the way. Maybe introduced new
ones. It doesn't help that NF functions (sometimes?)
use X for vertical and Y for horizontal position.
* contrib/hbnf/tests/mouse1.prg
% turn cursor off to avoid excessive flicker
* contrib/hbnf/fttext.c
* contrib/hbnf/tests/metaph.prg
* contrib/hbnf/tests/prtesc.prg
* extras/gtwvw/docs/funclist.txt
* formatting (mostly fighting long separator lines still)
* src/rtl/mousehb.c
% use HB_FUNC_TRANSLATE()
This commit is contained in:
@@ -16,6 +16,44 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-10-18 20:59 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/hbmisc/hb_f.c
|
||||
! fixed clang warning
|
||||
|
||||
* contrib/hbzebra/datamtrx.c
|
||||
! applied patch from Mindaugas, fixing literal truncation
|
||||
warning on MSVC. Thank you.
|
||||
|
||||
* include/harbour.hbx
|
||||
* src/rtl/mouse53.c
|
||||
+ added HB_MGETBOUNDS( /* @ */ nTop, /* @ */ nLeft, /* @ */ nBotton, /* @ */ nRight ) -> NIL
|
||||
|
||||
* contrib/hbnf/hbnf.hbx
|
||||
* contrib/hbnf/mouse.c
|
||||
* contrib/hbnf/mouse1.prg
|
||||
* all possible MS-DOS specific mouse handling
|
||||
functions rewritten in Harbour using core mouse API.
|
||||
Now the included sample more or less work.
|
||||
There are still two important functions (FT_MBUT*())
|
||||
that are MS-DOS specific and don't work. Have no
|
||||
idea yet how to rewrite these in multiplatform way,
|
||||
they work in very MS-DOS specific way.
|
||||
! fixed few bugs along the way. Maybe introduced new
|
||||
ones. It doesn't help that NF functions (sometimes?)
|
||||
use X for vertical and Y for horizontal position.
|
||||
|
||||
* contrib/hbnf/tests/mouse1.prg
|
||||
% turn cursor off to avoid excessive flicker
|
||||
|
||||
* contrib/hbnf/fttext.c
|
||||
* contrib/hbnf/tests/metaph.prg
|
||||
* contrib/hbnf/tests/prtesc.prg
|
||||
* extras/gtwvw/docs/funclist.txt
|
||||
* formatting (mostly fighting long separator lines still)
|
||||
|
||||
* src/rtl/mousehb.c
|
||||
% use HB_FUNC_TRANSLATE()
|
||||
|
||||
2012-10-18 14:50 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* INSTALL
|
||||
! found typo (while testing a diffing tool)
|
||||
@@ -160,19 +198,18 @@
|
||||
This is the complete list of MSVC warnings that remain
|
||||
after this:
|
||||
---
|
||||
harbour.y(1077) : warning C4244: '=' : conversion from 'HB_SIZE' to 'int', possible loss of data
|
||||
harbour.y(1371) : warning C4309: 'argument' : truncation of constant value
|
||||
harbour.y(1374) : warning C4309: 'argument' : truncation of constant value
|
||||
harboury.c(4089) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data
|
||||
harboury.c(7737) : warning C4702: unreachable code
|
||||
harboury.c(7776) : warning C4701: potentially uninitialized local variable 'hb_comp_yylval' used
|
||||
macroy.c(1786) : warning C4065: switch statement contains 'default' but no 'case' labels
|
||||
macroy.c(1915) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data
|
||||
macroy.c(3254) : warning C4702: unreachable code
|
||||
macroy.c(3293) : warning C4701: potentially uninitialized local variable 'hb_macro_yylval' used
|
||||
../../../dbffpt1.c(521) : warning C4310: cast truncates constant value
|
||||
../../../dbffpt1.c(904) : warning C4310: cast truncates constant value
|
||||
hbzebra\datamtrx.c(149) : warning C4310: cast truncates constant value
|
||||
harbour.y(1077) : warning C4244: '=' : conversion from 'HB_SIZE' to 'int', possible loss of data
|
||||
harbour.y(1371) : warning C4309: 'argument' : truncation of constant value
|
||||
harbour.y(1374) : warning C4309: 'argument' : truncation of constant value
|
||||
harboury.c(4089) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data
|
||||
harboury.c(7737) : warning C4702: unreachable code
|
||||
harboury.c(7776) : warning C4701: potentially uninitialized local variable 'hb_comp_yylval' used
|
||||
macroy.c(1786) : warning C4065: switch statement contains 'default' but no 'case' labels
|
||||
macroy.c(1915) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data
|
||||
macroy.c(3254) : warning C4702: unreachable code
|
||||
macroy.c(3293) : warning C4701: potentially uninitialized local variable 'hb_macro_yylval' used
|
||||
../../../dbffpt1.c(521) : warning C4310: cast truncates constant value
|
||||
../../../dbffpt1.c(904) : warning C4310: cast truncates constant value
|
||||
---
|
||||
|
||||
2012-10-17 22:04 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
|
||||
@@ -162,24 +162,23 @@ static long hb_hbfskip( PFT_TEXT ft_text, char * buffer, HB_SIZE bufsize, int re
|
||||
}
|
||||
else
|
||||
{
|
||||
recs = -recs;
|
||||
ft_text->isEof[ ft_text->area ] = HB_FALSE;
|
||||
recs = -recs;
|
||||
ft_text->isEof[ ft_text->area ] = HB_FALSE;
|
||||
|
||||
if( ( ft_text->recno[ ft_text->area ] - recs ) < 1 )
|
||||
return 1;
|
||||
|
||||
for( y = recs; y > 0; --y )
|
||||
{
|
||||
if( ft_text->offset[ ft_text->area ] - bufsize < 0 )
|
||||
read_pos = ( size_t ) ( ft_text->offset[ ft_text->area ] - bufsize );
|
||||
|
||||
if( read_pos < 0 )
|
||||
{
|
||||
read_pos = 0;
|
||||
read_len = ( size_t ) ft_text->offset[ ft_text->area ];
|
||||
}
|
||||
else
|
||||
{
|
||||
read_pos = ( size_t ) ( ft_text->offset[ ft_text->area ] - bufsize );
|
||||
read_len = bufsize;
|
||||
}
|
||||
|
||||
hb_fsSeekLarge( ft_text->handles[ ft_text->area ], read_pos, FS_SET );
|
||||
read_len = hb_fsReadLarge( ft_text->handles[ ft_text->area ], buffer, read_len );
|
||||
@@ -400,7 +399,6 @@ HB_FUNC( HB_FINFO ) /* used for debugging */
|
||||
It does its own skip and read, so an entire file can be read
|
||||
sequentially with just this function.
|
||||
-BH
|
||||
--------------------------------------------------
|
||||
*/
|
||||
HB_FUNC( HB_FREADANDSKIP )
|
||||
{
|
||||
|
||||
@@ -382,14 +382,12 @@ static long _ft_skip( long iRecs )
|
||||
ft_text->last_off[ ft_text->area ] = ft_text->offset[ ft_text->area ];
|
||||
ft_text->error[ ft_text->area ] = hb_fsError();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
iBytesRemaining = iBytesRead;
|
||||
/* parse the buffer while there's still stuff in it */
|
||||
do
|
||||
{
|
||||
|
||||
/* get count of chars in this line */
|
||||
iByteCount = _findeol( cPtr, iBytesRemaining );
|
||||
|
||||
@@ -476,7 +474,6 @@ static long _ft_skip( long iRecs )
|
||||
/* parse the buffer while there's still stuff in it */
|
||||
do
|
||||
{
|
||||
|
||||
/* get count of chars in this line */
|
||||
iByteCount = _findbol( cPtr, iBytesRemaining );
|
||||
|
||||
@@ -495,7 +492,6 @@ static long _ft_skip( long iRecs )
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* no more CRLFs in this buffer so we're either at
|
||||
BOF or record crosses buffer boundary */
|
||||
/* check for BOF */
|
||||
@@ -520,7 +516,6 @@ static long _ft_skip( long iRecs )
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ft_text->offset[ ft_text->area ] = 0;
|
||||
ft_text->recno[ ft_text->area ] = 1;
|
||||
ft_text->isBof[ ft_text->area ] = HB_TRUE;
|
||||
@@ -840,19 +835,17 @@ HB_FUNC( FT_FGOTO )
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
In-line assembler routine to parse a buffer
|
||||
for a CRLF pair
|
||||
|
||||
_findeol() - In-line assembler routine to parse a buffer
|
||||
for a CRLF pair
|
||||
Returns count to first character _after_ next
|
||||
CRLF pair (beginning of next line). Current line
|
||||
will contain the trailing CRLF. 1Ah and trailing
|
||||
LFs will be ignored (included in count).
|
||||
|
||||
Returns count to first character _after_ next
|
||||
CRLF pair (beginning of next line). Current line
|
||||
will contain the trailing CRLF. 1Ah and trailing
|
||||
LFs will be ignored (included in count).
|
||||
|
||||
If no CRLF found return is zero. (could mean EOF or
|
||||
line is longer than buffer end)
|
||||
|
||||
------------------------------------------------------------------------*/
|
||||
If no CRLF found return is zero. (could mean EOF or
|
||||
line is longer than buffer end)
|
||||
*/
|
||||
static HB_ISIZ _findeol( char * buf, HB_ISIZ buf_len )
|
||||
{
|
||||
HB_ISIZ tmp;
|
||||
@@ -869,17 +862,15 @@ static HB_ISIZ _findeol( char * buf, HB_ISIZ buf_len )
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
In-line assembler routine to parse a buffer
|
||||
for a CRLF pair
|
||||
|
||||
_findbol() - In-line assembler routine to parse a buffer
|
||||
for a CRLF pair
|
||||
|
||||
buf pointer points at beginning of search (end
|
||||
of the buffer), all searches are conducted
|
||||
backwards, returns No. of characters betw.
|
||||
initial position and first character _after_
|
||||
the preceding CRLF pair (beginning of line).
|
||||
|
||||
------------------------------------------------------------------------*/
|
||||
buf pointer points at beginning of search (end
|
||||
of the buffer), all searches are conducted
|
||||
backwards, returns No. of characters betw.
|
||||
initial position and first character _after_
|
||||
the preceding CRLF pair (beginning of line).
|
||||
*/
|
||||
static HB_ISIZ _findbol( char * buf, HB_ISIZ buf_len )
|
||||
{
|
||||
HB_ISIZ tmp = buf_len - 1;
|
||||
|
||||
@@ -240,7 +240,6 @@ DYNAMIC _FT_DFINIT
|
||||
DYNAMIC _FT_NWKSTAT
|
||||
DYNAMIC _FT_TEMPFIL
|
||||
DYNAMIC _MSET_SENSITIVE
|
||||
DYNAMIC _M_RESET
|
||||
|
||||
#if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBNF__REQUEST )
|
||||
#uncommand DYNAMIC <fncs,...> => EXTERNAL <fncs>
|
||||
|
||||
@@ -56,73 +56,6 @@
|
||||
# include <dos.h>
|
||||
#endif
|
||||
|
||||
HB_FUNC( FT_MGETPAGE )
|
||||
{
|
||||
int iPage;
|
||||
|
||||
#if defined( HB_OS_DOS ) && 0
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 0x1E;
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
iPage = regs.HB_XREGS.bx;
|
||||
}
|
||||
#else
|
||||
{
|
||||
iPage = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_retni( iPage );
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MSETPAGE )
|
||||
{
|
||||
#if defined( HB_OS_DOS ) && 0
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 0x1D;
|
||||
regs.HB_XREGS.bx = hb_parni( 1 );
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MVERSION )
|
||||
{
|
||||
int iMinor;
|
||||
int iType;
|
||||
int iIRQ;
|
||||
int iMajor;
|
||||
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
regs.HB_XREGS.ax = 0x24;
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
|
||||
iMinor = regs.h.bl;
|
||||
iType = regs.h.ch;
|
||||
iIRQ = regs.h.cl;
|
||||
iMajor = regs.h.bh;
|
||||
}
|
||||
#else
|
||||
{
|
||||
iMinor = 0;
|
||||
iType = 0;
|
||||
iIRQ = 0;
|
||||
iMajor = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_storni( iMinor, 1 );
|
||||
hb_storni( iType, 2 );
|
||||
hb_storni( iIRQ, 3 );
|
||||
|
||||
hb_retni( iMajor );
|
||||
}
|
||||
|
||||
HB_FUNC( _MSET_SENSITIVE ) /* nHoriz, nVert, nDouble */
|
||||
{
|
||||
#if defined( HB_OS_DOS )
|
||||
@@ -180,131 +113,6 @@ HB_FUNC( FT_MCONOFF )
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MMICKEYS )
|
||||
{
|
||||
int iX;
|
||||
int iY;
|
||||
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 0x0B;
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
iX = regs.HB_XREGS.cx;
|
||||
iY = regs.HB_XREGS.dx;
|
||||
}
|
||||
#else
|
||||
{
|
||||
iX = 0;
|
||||
iY = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_storni( 1, iX );
|
||||
hb_storni( 2, iY );
|
||||
}
|
||||
|
||||
HB_FUNC( _M_RESET )
|
||||
{
|
||||
HB_BOOL fMouse;
|
||||
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 0;
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
fMouse = regs.HB_XREGS.ax != 0;
|
||||
}
|
||||
#else
|
||||
{
|
||||
fMouse = HB_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_retl( fMouse );
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MGETPOS )
|
||||
{
|
||||
int iX;
|
||||
int iY;
|
||||
int iButton;
|
||||
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 3;
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
iX = regs.HB_XREGS.dx;
|
||||
iY = regs.HB_XREGS.cx;
|
||||
iButton = regs.HB_XREGS.bx;
|
||||
}
|
||||
#else
|
||||
{
|
||||
iX = 0;
|
||||
iY = 0;
|
||||
iButton = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_storni( iX, 1 );
|
||||
hb_storni( iY, 2 );
|
||||
|
||||
hb_retni( iButton );
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MSETPOS )
|
||||
{
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 4;
|
||||
regs.HB_XREGS.dx = hb_parni( 1 ); /* x */
|
||||
regs.HB_XREGS.cx = hb_parni( 2 ); /* y */
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MSETCOORD )
|
||||
{
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 4;
|
||||
regs.HB_XREGS.dx = hb_parni( 1 ) * 8; /* x */
|
||||
regs.HB_XREGS.cx = hb_parni( 2 ) * 8; /* y */
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MXLIMIT )
|
||||
{
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 7;
|
||||
regs.HB_XREGS.cx = hb_parni( 1 ); /* nXMin */
|
||||
regs.HB_XREGS.dx = hb_parni( 2 ); /* nXMax */
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MYLIMIT )
|
||||
{
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 8;
|
||||
regs.HB_XREGS.cx = hb_parni( 1 ); /* nYMin */
|
||||
regs.HB_XREGS.dx = hb_parni( 2 ); /* nYMax */
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MBUTPRS )
|
||||
{
|
||||
int inX;
|
||||
@@ -386,38 +194,3 @@ HB_FUNC( FT_MDEFCRS )
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( FT_MGETCOORD )
|
||||
{
|
||||
int inX;
|
||||
int inY;
|
||||
int inButton;
|
||||
|
||||
#if defined( HB_OS_DOS )
|
||||
{
|
||||
union REGS regs;
|
||||
regs.HB_XREGS.ax = 3;
|
||||
HB_DOS_INT86( 0x33, ®s, ®s );
|
||||
inX = regs.HB_XREGS.dx / 8;
|
||||
inY = regs.HB_XREGS.cx / 8;
|
||||
inButton = regs.HB_XREGS.bx;
|
||||
}
|
||||
#else
|
||||
{
|
||||
inX = 0;
|
||||
inY = 0;
|
||||
inButton = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_storni( inX, 1 );
|
||||
hb_storni( inY, 2 );
|
||||
|
||||
hb_retni( inButton );
|
||||
}
|
||||
|
||||
/* NOTE: This is what original NFLib did, returned
|
||||
vertical position (row) as X and
|
||||
horizontal position (col) as Y. [vszakats] */
|
||||
HB_FUNC_TRANSLATE( FT_MGETX, MROW )
|
||||
HB_FUNC_TRANSLATE( FT_MGETY, MCOL )
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
THREAD STATIC t_lCrsState := .F.
|
||||
THREAD STATIC t_lMinit := .F.
|
||||
THREAD STATIC t_lMInit := .F.
|
||||
|
||||
FUNCTION FT_MDBLCLK( nClick, nButton, nInterval, nRow, nCol, nStart )
|
||||
|
||||
@@ -25,7 +25,7 @@ FUNCTION FT_MDBLCLK( nClick, nButton, nInterval, nRow, nCol, nStart )
|
||||
|
||||
// Wait for first press if requested
|
||||
|
||||
DO WHILE !lDone
|
||||
DO WHILE ! lDone
|
||||
|
||||
FT_MBUTPRS( nButton, @nPrs, @nVert, @nHorz )
|
||||
nVert := Int( nVert / 8 )
|
||||
@@ -78,6 +78,41 @@ FUNCTION FT_MINREGION( nTR, nLC, nBR, nRC )
|
||||
MRow() >= nTR .AND. MRow() <= nBR .AND. ;
|
||||
MCol() >= nLC .AND. MCol() <= nRC
|
||||
|
||||
FUNCTION FT_MMICKEYS( /* @ */ nX, /* @ */ nY )
|
||||
|
||||
nX := MRow() * 8
|
||||
nY := MCol() * 8
|
||||
|
||||
RETURN NIL
|
||||
|
||||
FUNCTION FT_MGETPOS( /* @ */ nX, /* @ */ nY )
|
||||
|
||||
nX := MRow() * 8
|
||||
nY := MCol() * 8
|
||||
|
||||
RETURN ;
|
||||
iif( MLeftDown(), 1, 0 ) + ;
|
||||
iif( MRightDown(), 2, 0 ) + ;
|
||||
iif( hb_MMiddleDown(), 4, 0 )
|
||||
|
||||
FUNCTION FT_MSETPOS( nX, nY )
|
||||
|
||||
RETURN MSetPos( nX / 8, nY / 8 )
|
||||
|
||||
FUNCTION FT_MGETCOORD( /* @ */ nX, /* @ */ nY )
|
||||
|
||||
nX := MRow()
|
||||
nY := MCol()
|
||||
|
||||
RETURN ;
|
||||
iif( MLeftDown(), 1, 0 ) + ;
|
||||
iif( MRightDown(), 2, 0 ) + ;
|
||||
iif( hb_MMiddleDown(), 4, 0 )
|
||||
|
||||
FUNCTION FT_MSETCOORD( nX, nY )
|
||||
|
||||
RETURN MSetPos( nX, nY )
|
||||
|
||||
FUNCTION FT_MSETSENS( nHoriz, nVert, nDouble )
|
||||
|
||||
LOCAL nCurHoriz, nCurVert, nCurDouble
|
||||
@@ -94,28 +129,34 @@ FUNCTION FT_MSETSENS( nHoriz, nVert, nDouble )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
FUNCTION FT_MVERSION( /* @ */ nMinor, /* @ */ nType, /* @ */ nIRQ )
|
||||
|
||||
nMinor := 20
|
||||
nType := 2 /* serial */
|
||||
nIRQ := 3
|
||||
|
||||
RETURN 8
|
||||
|
||||
FUNCTION FT_MINIT()
|
||||
|
||||
// If not previously initialized then try
|
||||
|
||||
IF ! t_lMinit
|
||||
t_lMinit := ( FT_MRESET() != 0 )
|
||||
IF ! t_lMInit
|
||||
t_lMInit := ( FT_MRESET() != 0 )
|
||||
ELSE
|
||||
MSetBounds()
|
||||
ENDIF
|
||||
|
||||
RETURN t_lMinit
|
||||
RETURN t_lMInit
|
||||
|
||||
FUNCTION FT_MRESET()
|
||||
|
||||
LOCAL lStatus
|
||||
|
||||
t_lCrsState := .F. // Cursor is off after reset
|
||||
lStatus := _m_reset()
|
||||
|
||||
t_lCrsState := .F. // Cursor is off after reset
|
||||
MHide()
|
||||
MSetBounds()
|
||||
MSetPos( ( MaxRow() + 1 ) / 2, ( MaxCol() + 1 ) / 2 )
|
||||
|
||||
RETURN lStatus
|
||||
RETURN iif( MPresent(), -1, 0 )
|
||||
|
||||
FUNCTION FT_MCURSOR( lState )
|
||||
|
||||
@@ -146,3 +187,43 @@ FUNCTION FT_MHIDECRS() // decrement internal cursor flag and hide cursor
|
||||
t_lCrsState := .F.
|
||||
|
||||
RETURN NIL // no output from function
|
||||
|
||||
FUNCTION FT_MXLIMIT( nMin, nMax )
|
||||
|
||||
LOCAL nTop, nBottom
|
||||
|
||||
hb_MGetBounds( @nTop, , @nBottom )
|
||||
MSetBounds( nTop, nMin, nBottom, nMax )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
FUNCTION FT_MYLIMIT( nMin, nMax )
|
||||
|
||||
LOCAL nLeft, nRight
|
||||
|
||||
hb_MGetBounds( , @nLeft, , @nRight )
|
||||
MSetBounds( nMin, nLeft, nMax, nRight )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
/* NOTE: This is what original NFLib did, returned
|
||||
vertical position (row) as X and
|
||||
horizontal position (col) as Y. [vszakats] */
|
||||
|
||||
FUNCTION FT_MGETX()
|
||||
|
||||
RETURN MRow()
|
||||
|
||||
FUNCTION FT_MGETY()
|
||||
|
||||
RETURN MCol()
|
||||
|
||||
FUNCTION FT_MGETPAGE()
|
||||
RETURN 0
|
||||
|
||||
/* NOTE: Page is ignored in Harbour */
|
||||
FUNCTION FT_MSETPAGE( nPage )
|
||||
|
||||
HB_SYMBOL_UNUSED( nPage )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
@@ -88,16 +88,10 @@ PROCEDURE Main()
|
||||
|
||||
RETURN
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
STATIC FUNCTION _ftRow( nElem ) // Determine which row to print on
|
||||
|
||||
RETURN iif( nElem > 40, nElem - 40, iif( nElem > 20, nElem - 20, nElem ) )
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
STATIC FUNCTION _ftCol( nElem ) // Determine which column to start print
|
||||
|
||||
RETURN iif( nElem > 40, 55, iif( nElem > 20, 28, 1 ) )
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -39,6 +39,8 @@ PROCEDURE Main( nRow, nCol )
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
SET CURSOR OFF
|
||||
|
||||
// ..... Set up the screen
|
||||
cSavClr := SetColor( "w/n" )
|
||||
@ 0, 0, MaxRow(), MaxCol() BOX hb_UTF8ToStr( "░░░░░░░░░" )
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
|
||||
PROCEDURE Main( cParm1 )
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Sample routine to test function from command line
|
||||
//-------------------------------------------------------
|
||||
|
||||
IF PCount() > 0
|
||||
? FT_ESCCODE( cParm1 )
|
||||
ELSE
|
||||
|
||||
@@ -76,7 +76,10 @@
|
||||
#include "hbapierr.h"
|
||||
|
||||
|
||||
#define PADDING 129
|
||||
/* Special CodeWords */
|
||||
#define PADDING 129
|
||||
#define PAIR_OF_DIGITS 130 /* 00..99 encoded as 130..229 */
|
||||
#define SHIFT_EXTENDED_ASCII 235 /* Shift to extended ASCII for 1 character */
|
||||
|
||||
#define SIZE_COUNT 30
|
||||
|
||||
@@ -130,24 +133,24 @@ static int _datamatrix_isdigit( char ch )
|
||||
return '0' <= ch && ch <= '9';
|
||||
}
|
||||
|
||||
static int _datamatrix_encode( const char * szCode, int iLen, char * pCW )
|
||||
static int _datamatrix_encode( const char * szCode, int iLen, unsigned char * pCW )
|
||||
{
|
||||
int i, iPos = 0;
|
||||
for( i = 0; i < iLen; i++ )
|
||||
{
|
||||
if( _datamatrix_isdigit( szCode[ i ] ) && i < iLen - 1 && _datamatrix_isdigit( szCode[ i + 1 ] ) )
|
||||
{
|
||||
pCW[ iPos++ ] = ( szCode[ i ] - '0' ) * 10 + szCode[ i + 1 ] - '0' + 130;
|
||||
pCW[ iPos++ ] = ( unsigned char ) ( ( szCode[ i ] - '0' ) * 10 + szCode[ i + 1 ] - '0' + PAIR_OF_DIGITS );
|
||||
i++;
|
||||
}
|
||||
else if( ( unsigned char ) szCode[ i ] <= 127 )
|
||||
{
|
||||
pCW[ iPos++ ] = szCode[ i ] + 1;
|
||||
pCW[ iPos++ ] = ( unsigned char ) szCode[ i ] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pCW[ iPos++ ] = '\xEB'; /* Shift to extended ASCII for 1 character */
|
||||
pCW[ iPos++ ] = szCode[ i ] - 127;
|
||||
pCW[ iPos++ ] = SHIFT_EXTENDED_ASCII;
|
||||
pCW[ iPos++ ] = ( unsigned char ) szCode[ i ] - 127;
|
||||
}
|
||||
}
|
||||
return iPos;
|
||||
@@ -178,7 +181,7 @@ static void _reed_solomon_encode( unsigned char * pData, int iDataLen, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
static void _datamatrix_reed_solomon( char * pData, const DATAMATRIX_SIZE * pSize )
|
||||
static void _datamatrix_reed_solomon( unsigned char * pData, const DATAMATRIX_SIZE * pSize )
|
||||
{
|
||||
int * pPoly, * pExp, * pLog;
|
||||
int i, j, iBits, iMod, iPoly, iECLen, iIndex, iBlocks;
|
||||
@@ -233,7 +236,7 @@ static void _datamatrix_reed_solomon( char * pData, const DATAMATRIX_SIZE * pSiz
|
||||
|
||||
/* Copy to temporary buffer */
|
||||
for( j = i; j < pSize->iDataSize; j += iBlocks )
|
||||
data[ k++ ] = ( unsigned char ) pData[ j ];
|
||||
data[ k++ ] = pData[ j ];
|
||||
|
||||
/* Calculate Reed-Solomon ECC for one block */
|
||||
_reed_solomon_encode( data, k, ecc, pSize->iBlockErrorSize, pPoly, pExp, pLog, iMod );
|
||||
@@ -241,7 +244,7 @@ static void _datamatrix_reed_solomon( char * pData, const DATAMATRIX_SIZE * pSiz
|
||||
/* Copy ECC to codeword array */
|
||||
k = pSize->iBlockErrorSize;
|
||||
for( j = i; j < pSize->iBlockErrorSize * iBlocks; j += iBlocks )
|
||||
pData[ pSize->iDataSize + j ] = ( char ) ecc[ --k ];
|
||||
pData[ pSize->iDataSize + j ] = ecc[ --k ];
|
||||
}
|
||||
|
||||
hb_xfree( pExp );
|
||||
@@ -325,7 +328,7 @@ static void _datamatrix_place_d( int * pArr, int iPRow, int iPCol, int iIndex )
|
||||
_datamatrix_place_bit( pArr, iPRow, iPCol, 1, iPCol - 1, ( iIndex << 3 ) + 0 );
|
||||
}
|
||||
|
||||
static void _datamatrix_do_placement( PHB_BITBUFFER pBits, char * pCW, const DATAMATRIX_SIZE * pSize )
|
||||
static void _datamatrix_do_placement( PHB_BITBUFFER pBits, unsigned char * pCW, const DATAMATRIX_SIZE * pSize )
|
||||
{
|
||||
int * pArr;
|
||||
int i, iR, iC, iPRow, iPCol;
|
||||
@@ -404,7 +407,7 @@ PHB_ZEBRA hb_zebra_create_datamatrix( const char * szCode, HB_SIZE nLen, int iFl
|
||||
{
|
||||
PHB_ZEBRA pZebra;
|
||||
const DATAMATRIX_SIZE * pSize;
|
||||
char * pCW;
|
||||
unsigned char * pCW;
|
||||
int i, j, iDataCount, iErrorSize, iLen = ( int ) nLen;
|
||||
|
||||
pZebra = hb_zebra_create();
|
||||
@@ -416,7 +419,7 @@ PHB_ZEBRA hb_zebra_create_datamatrix( const char * szCode, HB_SIZE nLen, int iFl
|
||||
return pZebra;
|
||||
}
|
||||
|
||||
pCW = ( char * ) hb_xgrab( sizeof( char ) * iLen * 2 );
|
||||
pCW = ( unsigned char * ) hb_xgrab( sizeof( char ) * iLen * 2 );
|
||||
iDataCount = _datamatrix_encode( szCode, iLen, pCW );
|
||||
|
||||
if( iDataCount > 3116 )
|
||||
@@ -448,10 +451,10 @@ PHB_ZEBRA hb_zebra_create_datamatrix( const char * szCode, HB_SIZE nLen, int iFl
|
||||
|
||||
iErrorSize = ( pSize->iDataSize + 2 ) / pSize->iBlockSize * pSize->iBlockErrorSize;
|
||||
|
||||
pCW = ( char * ) hb_xrealloc( pCW, pSize->iDataSize + iErrorSize );
|
||||
pCW = ( unsigned char * ) hb_xrealloc( pCW, pSize->iDataSize + iErrorSize );
|
||||
for( i = iDataCount; i < pSize->iDataSize; i++ )
|
||||
{
|
||||
pCW[ i ] = ( char ) ( unsigned char ) PADDING;
|
||||
pCW[ i ] = PADDING;
|
||||
}
|
||||
|
||||
/* Reed-Solomon error correction */
|
||||
@@ -460,7 +463,7 @@ PHB_ZEBRA hb_zebra_create_datamatrix( const char * szCode, HB_SIZE nLen, int iFl
|
||||
#if 0
|
||||
for( i = 0; i < pSize->iDataSize + iErrorSize; i++ )
|
||||
{
|
||||
HB_TRACE( HB_TR_ALWAYS, ("cw=%d", ( unsigned char ) pCW[ i ] ));
|
||||
HB_TRACE( HB_TR_ALWAYS, ("cw=%d", pCW[ i ] ));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -674,6 +674,7 @@ DYNAMIC hb_MemoWrit
|
||||
DYNAMIC hb_MethodName
|
||||
DYNAMIC hb_milliSeconds
|
||||
DYNAMIC hb_Minute
|
||||
DYNAMIC hb_MGetBounds
|
||||
DYNAMIC hb_MMiddleDown
|
||||
DYNAMIC hb_mtvm
|
||||
DYNAMIC hb_mutexCreate
|
||||
|
||||
@@ -160,6 +160,18 @@ HB_FUNC( MSETBOUNDS )
|
||||
|
||||
#endif
|
||||
|
||||
HB_FUNC( HB_MGETBOUNDS )
|
||||
{
|
||||
int iTop, iLeft, iBottom, iRight;
|
||||
|
||||
hb_mouseGetBounds( &iTop, &iLeft, &iBottom, &iRight );
|
||||
|
||||
hb_storni( iTop, 1 );
|
||||
hb_storni( iLeft, 2 );
|
||||
hb_storni( iBottom, 3 );
|
||||
hb_storni( iRight, 4 );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_MMIDDLEDOWN )
|
||||
{
|
||||
hb_retl( hb_mouseButtonState( HB_MBUTTON_MIDDLE ) );
|
||||
|
||||
@@ -58,11 +58,6 @@
|
||||
original CA-Cl*pper namespace. It should have been marked as
|
||||
HB_EXTENSION, but it's not. */
|
||||
|
||||
HB_FUNC_EXTERN( HB_MMIDDLEDOWN );
|
||||
|
||||
HB_FUNC( MMIDDLEDOWN )
|
||||
{
|
||||
HB_FUNC_EXEC( HB_MMIDDLEDOWN );
|
||||
}
|
||||
HB_FUNC_TRANSLATE( MMIDDLEDOWN, HB_MMIDDLEDOWN )
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user