Page 10 of 16

Re: Migrating to Harbour

PostPosted: Sat Dec 20, 2014 10:22 pm
by Antonio Linares
it errors...

If you want Harbour you will have to drop "|" :-(

Life is hard :-D

Re: Migrating to Harbour

PostPosted: Sat Dec 20, 2014 11:24 pm
by Enrico Maria Giordano
Antonio,

as I said, that's not the last problem. There are many others. It looks like I have to drop Harbour definitely... :-(

EMG

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 9:32 am
by Antonio Linares
Enrico,

Well, to have a xHarbour expert with us is always a good thing :-)

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 10:17 am
by Enrico Maria Giordano
:D

Anyway, I'll slowly try again, as time permits...

EMG

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 3:55 pm
by Enrico Maria Giordano
Good news! I found a workaround (I replaced "|" with "+", it's not the same but worked fine in my case). Then I could fix the next problem too (I forgot the default value for an instance variable declared LOGICAL - xHarbour doesn't care).

It seems that now I can test my applications with Harbour! :-)

EMG

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 3:58 pm
by Enrico Maria Giordano
Next problem: xHarbour supports the third parameter for MemoWrit() to get rid of EOF character. How to do that with Harbour?

EMG

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 4:01 pm
by Enrico Maria Giordano
Found! Hb_MemoWrit(). :-)

EMG

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 5:21 pm
by hua
Enrico,
Normally if I want to try to convert to harbour I do this steps:

i. Add #include "xhb.ch" and linking in xhb.lib. To avoid having to add the header file to each prgs, I put it in fivewin.ch.

ii. Any regular expression statement is enclosed in brackets. For example cVar has ".*@.*\.com" will become (cVar has ".*@.*\.com"). That sentence would be compiled correctly under both xharbour and Harbour.

After grepping header files in harbour\contrib\xhb I found that logical operators have also been taken into account.
So 1|2 if written as (1|2) would be correctly preprocessed to hb_bitor(1,2) but your sample code uses macro so I'm not sure how to solve that.

Memowrit() is correctly pre-processed to use hb_memowrit() if the 3rd parameter is passed.

Hope that helps.

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 6:35 pm
by Enrico Maria Giordano
Thank you.

EMG

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 6:47 pm
by Enrico Maria Giordano
Do you know if the code below is the right way to handle non-ascii characters? With the two line commented out I get "testα".

Code: Select all  Expand view
#include "Fivewin.ch"

//REQUEST HB_CODEPAGE_ITWIN


FUNCTION MAIN()

//    HB_SETCODEPAGE( "ITWIN" )

    FCREATE( "testà" )

    RETURN NIL


EMG

Re: Migrating to Harbour

PostPosted: Sun Dec 21, 2014 7:01 pm
by Enrico Maria Giordano
One more problem. This is a sample:

Code: Select all  Expand view
FUNCTION MAIN()

    LOCAL oExcel := CREATEOBJECT( "Excel.Application" )

    LOCAL oSheet

    oExcel:WorkBooks:Add()

    oSheet = oExcel:ActiveSheet

    oSheet:Cells( 1, 1 ):Value = CTOD( "" )

    oExcel:Visible = .T.

    RETURN NIL


It errors out with the following error message:

Code: Select all  Expand view
Error WINOLE/1006   (0x800A03EC): _VALUE (DOS Error -2147352567)
Called from TOLEAUTO:_VALUE(0)
Called from MAIN(11)


EMG

Re: Migrating to Harbour

PostPosted: Mon Dec 22, 2014 4:17 am
by hua
Do you know if the code below is the right way to handle non-ascii characters? With the two line commented out I get "testα".


Sorry Enrico. My programs don't use non-ascii character so I don't have any knowledge nor experience about it. I only know the default codepage used by Harbour is CP437

The only observation I can offer you is that even enabling the rem'ed out lines I don't get testà. On my PC I had to change the code to as shown below to make it work.

Code: Select all  Expand view
#include "Fivewin.ch"
REQUEST HB_CODEPAGE_IT437

FUNCTION MAIN()
    HB_SETCODEPAGE( "IT437" )

    FCREATE( "testà" )

    RETURN NIL

Re: Migrating to Harbour

PostPosted: Mon Dec 22, 2014 9:46 am
by Enrico Maria Giordano
hua wrote:Sorry Enrico. My programs don't use non-ascii character so I don't have any knowledge nor experience about it.


I can't believe that. What if the user create a document with non-ascii characters and you have to copy or move or open or print it?

hua wrote:I only know the default codepage used by Harbour is CP437

The only observation I can offer you is that even enabling the rem'ed out lines I don't get testà. On my PC I had to change the code to as shown below to make it work.

Code: Select all  Expand view
#include "Fivewin.ch"
REQUEST HB_CODEPAGE_IT437

FUNCTION MAIN()
    HB_SETCODEPAGE( "IT437" )

    FCREATE( "testà" )

    RETURN NIL


Thank you. I can't believe that I'm the only one that uses non-ascii characters...

EMG

Re: Migrating to Harbour

PostPosted: Mon Dec 22, 2014 3:44 pm
by Enrico Maria Giordano
Enrico Maria Giordano wrote:One more problem. This is a sample:

Code: Select all  Expand view
FUNCTION MAIN()

    LOCAL oExcel := CREATEOBJECT( "Excel.Application" )

    LOCAL oSheet

    oExcel:WorkBooks:Add()

    oSheet = oExcel:ActiveSheet

    oSheet:Cells( 1, 1 ):Value = CTOD( "" )

    oExcel:Visible = .T.

    RETURN NIL


It errors out with the following error message:

Code: Select all  Expand view
Error WINOLE/1006   (0x800A03EC): _VALUE (DOS Error -2147352567)
Called from TOLEAUTO:_VALUE(0)
Called from MAIN(11)


EMG


Any suggestions? :-)

EMG

Re: Migrating to Harbour

PostPosted: Mon Dec 22, 2014 4:39 pm
by Antonio Linares
Enrico,

is the same code working with xHarbour ?

Is Excel already running ?