Migrating to Harbour
- Antonio Linares
- Site Admin
- Posts: 42456
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 20 times
- Been thanked: 58 times
- Contact:
Re: Migrating to Harbour
Enrico,
With my change your code is working fine here
I don't understand why it does not work fine for you there
With my change your code is working fine here
I don't understand why it does not work fine for you there
- Antonio Linares
- Site Admin
- Posts: 42456
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 20 times
- Been thanked: 58 times
- Contact:
Re: Migrating to Harbour
Also, I remind you that MemoLine() is very slow. So if you plan to get the lines of a large text, you should avoid it.
We have code in FWH for reading text lines much much faster
We have code in FWH for reading text lines much much faster
- Enrico Maria Giordano
- Posts: 8738
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Migrating to Harbour
Antonio,
It's working, but it's very slow as it doesn't use nPos parameter (reading the source code, it's not supported).
EMG
Antonio Linares wrote:Enrico,
With my change your code is working fine here
I don't understand why it does not work fine for you there
It's working, but it's very slow as it doesn't use nPos parameter (reading the source code, it's not supported).
EMG
- Enrico Maria Giordano
- Posts: 8738
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Migrating to Harbour
Antonio,
It's very fast in xHarbour using nPos parameter. I'm not going to change all my code only to test Harbour, sorry.
EMG
Antonio Linares wrote:Also, I remind you that MemoLine() is very slow. So if you plan to get the lines of a large text, you should avoid it.
We have code in FWH for reading text lines much much faster
It's very fast in xHarbour using nPos parameter. I'm not going to change all my code only to test Harbour, sorry.
EMG
- Rick Lipkin
- Posts: 2668
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: Migrating to Harbour
Enrico
I have been using some similar ( xHarbour ) code to pull out text stored in a Sql Memo field .. I do not know if it would make any difference in Harbour or not or whether it would be faster. As you can see, I do not pass any other parameters to MemoLine other than the text, the number of characters I wish to print and the line.
Rick Lipkin
I have been using some similar ( xHarbour ) code to pull out text stored in a Sql Memo field .. I do not know if it would make any difference in Harbour or not or whether it would be faster. As you can see, I do not pass any other parameters to MemoLine other than the text, the number of characters I wish to print and the line.
Rick Lipkin
Code: Select all | Expand
cComment := oRs:Fields("Comment"):Value
// Print comments
nLinCnt := MlCount( cComment, 70 ) // 110
IF nLinCnt > 0
FOR x := 1 to nLinCnt
cText := MemoLine( cComment, 70, x ) // 110
oPrint:Say( LINE,(oPrint:nHorzRes()*.02), cText, oFont10 )
Line += oFont10:nHeight
NEXT
Endif
- Enrico Maria Giordano
- Posts: 8738
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
- TimStone
- Posts: 2954
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Migrating to Harbour
EMG,
I use Harbour with FWH and MSVC 2013 ... and I have absolutely no speed issues with memos.
My clients add labor ( often a significant amount ) descriptions to invoices, plus all the disclaimers, etc. are all done with memo text ( memo fields ).
The display is instantaneous. The printing is also incredibly fast.
I don't know what you are doing, but as Antonio said, I see no reason why it should be slow.
Tim
I use Harbour with FWH and MSVC 2013 ... and I have absolutely no speed issues with memos.
My clients add labor ( often a significant amount ) descriptions to invoices, plus all the disclaimers, etc. are all done with memo text ( memo fields ).
The display is instantaneous. The printing is also incredibly fast.
I don't know what you are doing, but as Antonio said, I see no reason why it should be slow.
Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
- Enrico Maria Giordano
- Posts: 8738
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Migrating to Harbour
Tim,
this is a sample:
With parameter nPos (supported by xHarbour) it lasts 0.00 seconds.
EMG
this is a sample:
Code: Select all | Expand
FUNCTION MAIN()
LOCAL cTxt := REPLICATE( "This is a test" + CHR( 13 ) + CHR( 10 ), 10000 )
LOCAL cNew := ""
LOCAL nLines
LOCAL nSec
LOCAL i
nLines = MLCOUNT( cTxt, 1024, , .F., .T. )
? "Lines:", LTRIM( STR( nLines ) )
?
nSec = SECONDS()
FOR i = 1 TO nLines
cNew += ALLTRIM( MEMOLINE( cTxt, 1024, i, , .F., .T. ) ) + CHR( 13 ) + CHR( 10 )
NEXT
? "Seconds:", SECONDS() - nSec
nLines = MLCOUNT( cNew, 1024, , .F., .T. )
? "Lines:", LTRIM( STR( nLines ) )
RETURN NIL
With parameter nPos (supported by xHarbour) it lasts 0.00 seconds.
EMG
- TimStone
- Posts: 2954
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Migrating to Harbour
Enrico,
I will admit I do not test for elapsed time. That is way too theoretical for me. I look at "real world" speeds and that is judged by my clients evaluation of performance.
So, for printing a memo text:
FOR lx := 1 TO MLCount( oTrec:rectxt, 60,, .t. )
PAGEHEAD( oPrn, aHead )
oPrn:Say( nRow, 2 * nCsp, MEMOLINE( oTrec:rectxt, 60, lx,, .t. ), oFnorm )
nRow += nRsp
NEXT
Where rectxt is the memo field in the record. I find that this certainly works faster than a laser printer can push it out.
As for looking at, and editing, the text in a record, I have a multi-line get that I use with the MEMO variable. It is "instant loading". That means, as I browse up and down a list, the memo is displayed ( along with the other data fields ) in the upper half of the dialog. The display in instantaneous.
Tim
I will admit I do not test for elapsed time. That is way too theoretical for me. I look at "real world" speeds and that is judged by my clients evaluation of performance.
So, for printing a memo text:
FOR lx := 1 TO MLCount( oTrec:rectxt, 60,, .t. )
PAGEHEAD( oPrn, aHead )
oPrn:Say( nRow, 2 * nCsp, MEMOLINE( oTrec:rectxt, 60, lx,, .t. ), oFnorm )
nRow += nRsp
NEXT
Where rectxt is the memo field in the record. I find that this certainly works faster than a laser printer can push it out.
As for looking at, and editing, the text in a record, I have a multi-line get that I use with the MEMO variable. It is "instant loading". That means, as I browse up and down a list, the memo is displayed ( along with the other data fields ) in the upper half of the dialog. The display in instantaneous.
Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
- Antonio Linares
- Site Admin
- Posts: 42456
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 20 times
- Been thanked: 58 times
- Contact:
Re: Migrating to Harbour
Enrico,
Here is the source code for MemoLine():
https://github.com/harbour/core/blob/master/src/rtl/mlcfunc.c
So it seems as it does not support the same parameters as xHarbour. We could compare xHarbour and Harbour and propose to enhance such function as you need it.
Here is the source code for MemoLine():
https://github.com/harbour/core/blob/master/src/rtl/mlcfunc.c
/* MemoLine( <cString>, [ <nLineLength>=79 ],
* [ <nLineNumber>=1 ],
* [ <nTabSize>=4 ], [ <lWrap>=.T. ],
* [ <cEOL>|<acEOLs> ] ) -> <cLine>
*/
So it seems as it does not support the same parameters as xHarbour. We could compare xHarbour and Harbour and propose to enhance such function as you need it.
- Enrico Maria Giordano
- Posts: 8738
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Migrating to Harbour
Tim,
It's not theoretical for me. It's been the solution to a specific slowness problem.
EMG
TimStone wrote:I will admit I do not test for elapsed time. That is way too theoretical for me.
It's not theoretical for me. It's been the solution to a specific slowness problem.
EMG
- Enrico Maria Giordano
- Posts: 8738
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Migrating to Harbour
Antonio,
Thank you!
EMG
Antonio Linares wrote:We could compare xHarbour and Harbour and propose to enhance such function as you need it.
Thank you!
EMG
- Antonio Linares
- Site Admin
- Posts: 42456
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 20 times
- Been thanked: 58 times
- Contact:
Re: Migrating to Harbour
Enrico,
Now we need to get the xHarbour MemoLine() source code
Do you have it at hand ?
Now we need to get the xHarbour MemoLine() source code
Do you have it at hand ?
- Enrico Maria Giordano
- Posts: 8738
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Migrating to Harbour
Antonio,
here it is:
EMG
here it is:
Code: Select all | Expand
HB_FUNC( MEMOLINE )
{
HB_SIZE ulLen, ulLineLength, ulTabSize;
BOOL fWordWrap;
PHB_EOL_INFO pEOLs;
int iEOLs;
const char * pszString = hb_mlGetParams( 1, &ulLen, &ulLineLength,
&ulTabSize, &fWordWrap,
&pEOLs, &iEOLs );
char * szLine;
ULONG ulLine = hb_parnl( 3 );
HB_SIZE ulEnd, ulOffset = ISNUM( 7 ) ? hb_parnl( 7 ) - 1 : 0;
HB_SIZE ulCols = 0;
if( ! pszString )
{
hb_retc( NULL );
return;
}
if( ulLine == 0 )
{
ulLine = 1;
}
while( --ulLine && ulOffset < ulLen )
{
ulOffset = hb_mlGetLine( pszString, ulLen, ulOffset,
ulLineLength, ulTabSize, 0, fWordWrap,
pEOLs, iEOLs, &ulCols, NULL );
}
ulEnd = ulOffset;
if( ulOffset < ulLen )
{
ULONG ulCol = 0;
ulEnd = hb_mlGetLine( pszString, ulLen, ulOffset,
ulLineLength, ulTabSize, 0, fWordWrap,
pEOLs, iEOLs, &ulCols, NULL );
szLine = ( char * ) hb_xgrab( ulLineLength + 1 );
while( ulCol < ulCols )
{
if( pszString[ ulOffset ] == HB_CHAR_HT )
{
HB_SIZE ul = ulTabSize - ( ulCol % ulTabSize );
do
{
szLine[ ulCol++ ] = ' ';
}
while( --ul && ulCol < ulCols );
}
else if( pszString[ ulOffset ] == HB_CHAR_SOFT1 &&
pszString[ ulOffset + 1 ] == HB_CHAR_SOFT2 )
{
ulOffset++;
}
else
{
szLine[ ulCol++ ] = pszString[ ulOffset ];
}
ulOffset++;
}
if( ulCols < ulLineLength )
{
memset( szLine + ulCols, ' ', ( size_t ) ( ulLineLength - ulCols ) );
}
szLine[ ulLineLength ] = 0;
hb_retclen_buffer( szLine, ulLineLength );
}
else
{
hb_retc( NULL );
}
hb_xfree( pEOLs );
if( ISBYREF( 7 ) )
{
hb_stornl( ( LONG ) ulEnd + 1, 7 );
}
}
EMG
- Antonio Linares
- Site Admin
- Posts: 42456
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 20 times
- Been thanked: 58 times
- Contact: