2007-05-08 16:06 UTC+0300 Chen Kedem <niki@actcom.co.il>
This commit is contained in:
@@ -8,6 +8,14 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-05-08 16:06 UTC+0300 Chen Kedem <niki@actcom.co.il>
|
||||
* source/rtl/mlctopos.c
|
||||
! Make the function MLCTOPOS() more compatible.
|
||||
TOFIX note added about existing problems.
|
||||
|
||||
* utils/hbtest/rt_misc.prg
|
||||
+ Add some tests for MLCTOPOS()
|
||||
|
||||
2007-05-07 19:42 UTC+0100 Antonio Linares (alinares@fivetechsoft.com)
|
||||
* contrib/adordd/adordd.prg
|
||||
* Added some connection strings, borrowed from xharbour
|
||||
|
||||
@@ -50,6 +50,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
TOFIX: The function is still not compatible, TAB's in the ulLine are not
|
||||
expanded, and there are other problems. HBTest show some of the
|
||||
differences. 2007-05-08 [ckedem]
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
HB_FUNC( MLCTOPOS )
|
||||
@@ -66,7 +72,7 @@ HB_FUNC( MLCTOPOS )
|
||||
ULONG ulLines = 1;
|
||||
ULONG ulPos;
|
||||
ULONG ulBegOfLine = 0;
|
||||
ULONG ulLastLen = 0;
|
||||
/* ULONG ulLastLen = 0; */
|
||||
|
||||
if( ulLineLength < 4 || ulLineLength > 254 )
|
||||
ulLineLength = 79;
|
||||
@@ -85,7 +91,7 @@ HB_FUNC( MLCTOPOS )
|
||||
|
||||
case HB_CHAR_LF:
|
||||
ulBegOfLine = ulPos - ulCurLength;
|
||||
ulLastLen = ulCurLength;
|
||||
/* ulLastLen = ulCurLength; */
|
||||
ulCurLength = 0;
|
||||
ulLastSpace = 0;
|
||||
ulLines++;
|
||||
@@ -118,26 +124,33 @@ HB_FUNC( MLCTOPOS )
|
||||
ulLines++;
|
||||
ulLastSpace = 0;
|
||||
ulBegOfLine = ulPos - ulCurLength;
|
||||
ulLastLen = ulCurLength ;
|
||||
/* ulLastLen = ulCurLength ; */
|
||||
}
|
||||
}
|
||||
|
||||
if( ulCurLength > 0 )
|
||||
{
|
||||
ulBegOfLine = ulPos - ulCurLength;
|
||||
ulLastLen = ulCurLength ;
|
||||
/* ulLastLen = ulCurLength ; */
|
||||
}
|
||||
|
||||
ulLen++;
|
||||
|
||||
if( ulLine == ulLines )
|
||||
{
|
||||
#if 0
|
||||
if( ulLastLen )
|
||||
ulLastLen--; /* Column is zero based */
|
||||
ulPos = ulBegOfLine + 1 + ( ( ulCol < ulLastLen ) ? ulCol : ulLastLen );
|
||||
#endif
|
||||
ulPos = ulBegOfLine + 1 + ulCol;
|
||||
|
||||
/* When wordwrap is active, skip the first space if not on the first line */
|
||||
if( bWordWrap && !ulCol && ulLine > 1 )
|
||||
if( pszString[ ulPos - 1 ] == ' ' || pszString[ ulPos - 1 ] == HB_CHAR_HT )
|
||||
ulPos++;
|
||||
if( ulPos > ulLen )
|
||||
ulPos = ulLen;
|
||||
hb_retnl( ulPos );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -714,6 +714,54 @@ FUNCTION Main_MISC()
|
||||
|
||||
#endif
|
||||
|
||||
/* MLCTOPOS() */
|
||||
|
||||
TEST_LINE( MLCTOPOS( 'A message from me', 10, 2, 0 ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( 'A message from me', 5, 2, 0, 4, .F. ) , 6 )
|
||||
TEST_LINE( MLCTOPOS( 'A'+CHR(9)+'message'+CHR(9)+'from'+CHR(9)+'me', 10, 2, 0, 8 ) , 3 )
|
||||
TEST_LINE( MLCTOPOS( 'abcd efg hijk lm nopqr stu vwxyz', 5, 3, 0 ) , 10 )
|
||||
TEST_LINE( MLCTOPOS( 'abcd efg hijk lm nopqr stu vwxyz', 8, 2, 0 ) , 10 )
|
||||
TEST_LINE( MLCTOPOS( 'abcd efg hijk lm nopqr stu vwxyz', 8, 2, 0,, .F. ) , 9 )
|
||||
TEST_LINE( MLCTOPOS( 'A message from our me', 9, 2, 0 ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( 'A message from our me', 9, 2, 0 ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( 'A message'+CHR(9)+'from me', 10, 2, 0 ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( 'A message from me', 9, 2, 0,, .F. ) , 10 )
|
||||
TEST_LINE( MLCTOPOS( 'A message from me', 9, 2, 0,, .F. ) , 10 )
|
||||
TEST_LINE( MLCTOPOS( 'A message'+CHR(141)+'from me', 10, 2, 0 ) , 3 )
|
||||
TEST_LINE( MLCTOPOS( 'A message'+CHR(141)+'from me', 9, 2, 0 ) , 3 )
|
||||
TEST_LINE( MLCTOPOS( 'A message'+CHR(141)+'from me', 10, 2, 0,, .F. ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( 'A message'+CHR(141)+'from me', 9, 2, 0,, .F. ) , 10 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 0 ) , 1 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 8 ) , 9 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 9 ) , 10 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 10 ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 11 ) , 12 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 360 ) , 17 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 0,, .F. ) , 1 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 8,, .F. ) , 9 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 9,, .F. ) , 10 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 10,, .F. ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 11,, .F. ) , 12 )
|
||||
TEST_LINE( MLCTOPOS( ' message from me', 10, 1, 360,, .F. ) , 17 )
|
||||
TEST_LINE( MLCTOPOS( ' message'+CHR(9)+'from me', 10, 1, 11,, .T. ) , 9 )
|
||||
TEST_LINE( MLCTOPOS( ' message'+CHR(9)+'from me', 10, 1, 11,, .F. ) , 9 )
|
||||
TEST_LINE( MLCTOPOS( ' message'+CHR(9)+'from me', 10, 2, 11 ) , 17 )
|
||||
TEST_LINE( MLCTOPOS( ' message'+CHR(9)+'from me', 10, 1, 15,, .T. ) , 13 )
|
||||
TEST_LINE( MLCTOPOS( ' message'+CHR(9)+'from me', 10, 1, 15,, .F. ) , 13 )
|
||||
TEST_LINE( MLCTOPOS( CHR(13)+CHR(10)+' message'+CHR(9)+'from me', 10, 1, 15,, .F. ) , 1 )
|
||||
TEST_LINE( MLCTOPOS( CHR(13)+CHR(10)+' message'+CHR(9)+'from me', 10, 1, 15,, .T. ) , 1 )
|
||||
TEST_LINE( MLCTOPOS( 'A '+CHR(13)+CHR(10)+'message from me', 9, 2, 0 ) , 5 )
|
||||
TEST_LINE( MLCTOPOS( 'A '+CHR(141)+CHR(10)+'message from me', 9, 2, 0 ) , 13 )
|
||||
TEST_LINE( MLCTOPOS( 'A'+CHR(141)+CHR(10)+'message from me', 9, 2, 0 ) , 12 )
|
||||
TEST_LINE( MLCTOPOS( 'A'+CHR(141)+'message from me', 9, 2, 0 ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( 'A'+CHR(13)+'message from me', 9, 2, 0 ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( 'A'+CHR(10)+'message from me', 9, 2, 0 ) , 11 )
|
||||
TEST_LINE( MLCTOPOS( 'A '+CHR(13)+'message from me', 9, 2, 0 ) , 3 )
|
||||
TEST_LINE( MLCTOPOS( 'A '+CHR(10)+'message from me', 9, 2, 0 ) , 3 )
|
||||
TEST_LINE( MLCTOPOS( 'A message from me', 10, 7, 0 ) , 18 )
|
||||
TEST_LINE( MLCTOPOS( , , , ) , 1 )
|
||||
TEST_LINE( MLCTOPOS( , .T., , ) , 1 )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
#ifdef __HARBOUR__
|
||||
|
||||
Reference in New Issue
Block a user