Page 1 of 2

xHarbour -> Harbour compatibility

Posted: Wed Jan 14, 2009 9:14 am
by fraxzi
Hi!

I wish to test my xHarbour+FWH8.12 to Harbour 1.0.1

problem is... I have GLOBAL and GLOBAL EXTERNAL declarations... massive like entirely on my .prgs'

question is... What can I do?


Regards,

Re: xHarbour -> Harbour compatibility

Posted: Wed Jan 14, 2009 10:58 am
by Ale SB
I converts a system with my Xharbour to Harbour without any problem, but I used this harbour:

http://sourceforge.net/project/download ... p&65460143

because he thought more complete, the xHb.lib used to avoid conflicts in some statements to my xharbour.

It worked smoothly

Saluds, Ale

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 2:00 am
by fraxzi
Hello Ale,

I tried to include xHB.lib but I still having errors on my GLOBAL..EXTERNAL variables

Using xMate compiling xHarbour App to Harbour 1.0.1:

Image

Regards

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 2:19 am
by Antonio Linares
Frances,

Try this define:

#define GLOBAL public

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 3:30 am
by fraxzi
Antonio Linares wrote:Frances,

Try this define:

#define GLOBAL public

Mr. Antonio,

Thank you for the suggestion and reply.

Public has to be inside procedure/function... I will just move my variable declarations into my init procedure...

But what about the GLOBAL EXTERNAL? would it be #define GLOBAL EXTERNAL public ?


Regards

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 7:19 am
by mmercado
fraxzi wrote:But what about the GLOBAL EXTERNAL? would it be #define GLOBAL EXTERNAL public ?
Hi Mr. Frances:

I think you'll get the same efect with: #xtransalate GLOBAL EXTERNAL => Public

Regards.

Manuel Mercado.

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 7:25 am
by mmercado
mmercado wrote:I think you'll get the same efect with: #xtransalate GLOBAL EXTERNAL => Public
Sorry for the typo, I meant:
#xtranslate GLOBAL EXTERNAL => Public

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 7:38 am
by fraxzi
Thank you so much Gurus Manuel and Antonio,

But after compilation.... I have tons of to do...

I need to abandon and going back to xHarbour where all apps are written... :wink:

sorry.

Kind regards,

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 7:44 am
by anserkk
Dear Mr.Fraxzi,

Can I ask you the reason for moving from xHarbour to Harbour.

Any advantage ? Or is it just for testing purpose

Regards

Anser

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 8:09 am
by fraxzi
anserkk wrote:Dear Mr.Fraxzi,

Can I ask you the reason for moving from xHarbour to Harbour.

Any advantage ? Or is it just for testing purpose

Regards

Anser

Mr. Anser,

Nice to hear from you again.

I dont mind answering.... well, I havent tried Harbour ever since I jumped to xHarbour...
I noticed that Harbour project is more active than xHarbour (based on release dates) so I just wonder what could be the experience and difference (?).

I guess I wouldn't know the advantage... But i'm still optimistic in converting/testing my apps with Harbour 1.0.1 or latest.


Regards,

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 8:15 am
by anserkk
Dear Mr.Fraxzi,

Thankyou for the explanation :D

Regards

Anser

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 8:57 am
by StefanHaupt
Manuel,
mmercado wrote:
mmercado wrote:I think you'll get the same efect with: #xtranslate GLOBAL EXTERNAL => Public
I think, GLOBAL EXTERNAL must be replaced by MEMVAR, because you define a (GLOBAL) PUBLIC variable in the main module and then in all other modules using this variable, you have to decleare this variable as GLOBAL EXTERNAL or MEMVAR.

Code: Select all

#xtranslate GLOBAL EXTERNAL => MEMVAR

Re: xHarbour -> Harbour compatibility

Posted: Thu Jan 15, 2009 9:36 am
by Antonio Linares
Frances, Stefan,

yes, I agree too that you could use Stefan suggestion, to translate global external into memvar.

Re: xHarbour -> Harbour compatibility

Posted: Fri Jan 16, 2009 11:11 am
by xProgrammer
Whilst it isn't a direct replacement in the sense that it isn't a matter of simply using an #xcommand or #xtranslate you can achieve the required outcome using a class to hold all your globals as member variables. I find this technique very useful.

You could use something along the following lines:

Code: Select all

CLASS GlobalData

DATA ADSServer
DATA ADSLogin
...

METHOD New() CONSTRUCTOR

ENDCLASS

METHOD New() CLASS GlobalData

::ADSServer := 0
::ADSLogin := 0
...

RETURN self

Re: xHarbour -> Harbour compatibility

Posted: Fri Jan 16, 2009 11:17 am
by demont frank
Hello,

In old days , in clipper , global variables were simulated as :

In prog1

GLOBAL var1 change in STATIC Var1

# ifdef __XHARBOUR
GLOBAL Var1
# else
STATIC Var1
# endif

In prg1 we provide a function
# ifndef __XHARBOUR
FUNCTION Var1()
RETURN var1

Or
FUNCTION Var1(NewValue)
IF PCOUNT()>0
Var1 := NewValue
END
RETURN var1

# endif

In other modules

# ifdef __XHARBOUR
GLOBAL EXTERNAL Var1
# else
# xtranslate var1=>var1()
# endif


Frank