Migrating to Harbour

Migrating to Harbour

Postby Enrico Maria Giordano » Thu Oct 03, 2013 6:20 pm

Dear friends, I started again my experiment with Harbour. :-)

The first problem I encountered was the CreateObject() function, solved by linking xhb.lib and hbwin.lib.

Now a new problem: TRY/CATCH/END. Imagine you have one thousand PRGs. How to make them compilable with Harbour without spending the rest of your life in the effort? :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8704
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Rick Lipkin » Thu Oct 03, 2013 6:27 pm

Enrico

There is an include file for the Try\Catch .. I think it is HbCompat.ch .. something like that :(

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2662
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Migrating to Harbour

Postby Badara Thiam » Thu Oct 03, 2013 7:13 pm

Enrico,

I can say you today « it's possible before the end of your life, but not sure. »

If your code have no needed CT TOOL3 functions and no GRAPHIC's functions
like Light Lib Graphic or Fern's Graphics Library, i think it's very little hard,
but this was not my chance... Fivewin was the Windows Lib i used, after tests
on Clip4Win, to help me to replace Dos graphics functions, with Clipper 5.3b and Blinker 7.

I not remember all the problems encountered. Very too much.
But i not support to let my prg to become obsolete.
I have writted or rewritted some hundred functions before to be able to generate
my first old Graphic Dos main menu under Windows without externals !

I don't know if it's simple today.
Badara Thiam
http://www.icim.fr
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Thu Oct 03, 2013 8:29 pm

Rick,

Rick Lipkin wrote:Enrico

There is an include file for the Try\Catch .. I think it is HbCompat.ch .. something like that :(

Rick Lipkin


I already knew about hbcompat.ch but to use it I'd have to modify all my one thousand PRGs. :-)

I tried to add

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


to std.ch but strangely enough it looks like Harbour doesn't read std.ch... :?:

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8704
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Thu Oct 03, 2013 8:33 pm

Badara,

Badara Thiam wrote:Enrico,

I can say you today « it's possible before the end of your life, but not sure. »

If your code have no needed CT TOOL3 functions and no GRAPHIC's functions
like Light Lib Graphic or Fern's Graphics Library, i think it's very little hard,
but this was not my chance... Fivewin was the Windows Lib i used, after tests
on Clip4Win, to help me to replace Dos graphics functions, with Clipper 5.3b and Blinker 7.

I not remember all the problems encountered. Very too much.
But i not support to let my prg to become obsolete.
I have writted or rewritted some hundred functions before to be able to generate
my first old Graphic Dos main menu under Windows without externals !

I don't know if it's simple today.


I used xHarbour since the very beginning. I'd just want to try Harbour now.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8704
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Badara Thiam » Thu Oct 03, 2013 8:37 pm

Migrate to Windows apps was very more complicated for me than, after, migrate to 32 bit with [x]Harbour.
With [x]Harbour the problem was to find CATOOLS III similars functions. Just found few ones.
Badara Thiam
http://www.icim.fr
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

Re: Migrating to Harbour

Postby Rick Lipkin » Thu Oct 03, 2013 8:53 pm

Enrico

I knew about the syntax difference in Try\Catch between xHarbour and Harbour and (like you) did not want to go through all my code to add HbCompat.ch.

I would like to try Harbour as well but I have way too many Try\Catch phrases myself... it would be nice if there was an easy solution... did you try adding hbCompat.Ch to FiveWin.ch ?

I am watching this thread with much interest.

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2662
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Thu Oct 03, 2013 9:17 pm

Rick,

Rick Lipkin wrote:Enrico

I knew about the syntax difference in Try\Catch between xHarbour and Harbour and (like you) did not want to go through all my code to add HbCompat.ch.

I would like to try Harbour as well but I have way too many Try\Catch phrases myself... it would be nice if there was an easy solution... did you try adding hbCompat.Ch to FiveWin.ch ?


For now I'm testing simple console mode samples but I'm pretty sure that adding hbcompat.ch to fivewin.ch will fix the problem.

Any ideas about console mode (ie. pure [x]Harbour samples, no FWH)?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8704
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Thu Oct 03, 2013 9:32 pm

I renamed std.ch and Harbour continue to compile commands like USE! :?: :?: :?:

I'm surely missing something...

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8704
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Thu Oct 03, 2013 9:34 pm

I just tried the same with xHarbour and get the same result! Help please, I'm very confused now!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8704
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Lautaro » Thu Oct 03, 2013 10:30 pm

Hello,

Harbour not read std.ch file, harbour use a std.ch included in the compiler, for use std.ch you must be use switch /u+<file> in compiler script for include a new command file in the compilation.

Sorry for my bad english.


Atte.,

Lautaro
User avatar
Lautaro
 
Posts: 322
Joined: Fri Oct 07, 2005 2:44 pm
Location: Osorno, Chile

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Thu Oct 03, 2013 10:33 pm

Lautaro,

Lautaro wrote:Hello,

Harbour not read std.ch file, harbour use a std.ch included in the compiler, for use std.ch you must be use switch /u+<file> in compiler script for include a new command file in the compilation.


Thank you for the info!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8704
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby rhlawek » Thu Oct 03, 2013 11:18 pm

Perhaps this will help. Sorry for being verbose.

I use hbmk2 with .hbp and .hbm files for building everything I do, which has the added benefit of making it easy to use different compilers and move across platforms. I use msvc, both 32 and 64 bit, for regular work, but I can switch to any compiler seamlessly, as well as to Linux depending upon the features of an app. Please note that I don't take credit for this work Viktor Szakáts provided the original ideas, did all the hbmk2 work, and deserves a great deal of credit for his work. There is much more to hbmk2 than I've noted below.

For my VS2012 machine I use a batch file such as the following to set up the environment for building.

//hb32.bat
set PATH=c:\harbour\bin;%PATH%
cd c:\fwh\samples
call "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
start "Harbour 32 bit Environment"

Given hello.prg

procedure main()
? "Hello World!"
return

Compiling hello.prg then becomes:

hbmk2 hello.prg

If there are a number of prg files it could be:

hbmk2 hello.prg mod1.prg mod2.prg

If I have code with xharbour syntax, as follows, the hbcompat.ch file can be included on the build line without having to add it to each separate source, it gets included as would any standard header:

procedure main()
TRY
? "Hello World!"
CATCH
END
return

hbmk2 hello.prg hbcompat.ch

As for FWH, I started with harbour well before I ever used FWH and I had an established build environment already. I long ago ported the batch files FiveWin provides and put the libraries and paths referenced there within a single .hbm file, which I can use unchanged regardless of compiler being used, or platform. I've included below a version edited to match what FWH would normally install for 32 bits on Windows. I actually use a different directory structure than this to make it easier to deal with multiple compilers without having to maintain multiple build scripts. I'll be happy to share that, but I want to discuss it with Antonio offline first.

procedure main()
USE "customer.dbf" ALIAS cust
TRY
Browse()
CATCH
END
return

hbmk2 hello.prg hbcompat.ch c:\harbour\fwh.hbm

Below is the fwh.hbm file I use, but I've edited it to be usable with standard FWH paths, as the actual one I use conforms to harbour's standard library placement. One thing you will note is the libraries do not include the .lib extension. This is intentional and is done in all my build scripts because it makes them compiler agnostic, I don't change anything to go from msvc and its xhb.lib file to mingw and its xhb.a lib file. hbmk2 will actually warn about including extensions making things less portable.

You will notice I use forward slashes instead of back slashes for WIndows, it works and keeps things more compatible with my linux builds. These lines all start with {win}, which seems redundant if compiling on windows, but I use the same build files for linux, where they get prefixed by {linux} for the linux specific stuff...the linux tags are ignore on windows and vice versa. I've just not included them here to avoid confusing things.

// fwh.hbm

# Should be compatible with standard FWH 32 bit install.

# it's a multithreaded gui
-gui
-mt

-incpath=/fwh/include
-L/fwh/lib

# Harbour libraries required by FWH
{win}-lxhb
{win}-lhbct
{win}-lhbwin
{win}-lpng

# All FWH for windows
{win}-lFiveH
{win}-lFiveHC

# All Windows libraries required for FWH
{win}-lversion
{win}-lmsimg32
{win}-loledlg
{win}-lpsapi
{win}-lkernel32
{win}-luser32
{win}-lgdi32
{win}-lwinspool
{win}-lcomctl32
{win}-lcomdlg32
{win}-ladvapi32
{win}-lshell32
{win}-lole32
{win}-loleaut32
{win}-luuid
{win}-lodbc32
{win}-lodbccp32
{win}-liphlpapi
{win}-lmpr
{win}-lwsock32
{win}-lgdiplus
{win}-lwinmm
{win}-lWS2_32

// fwh.hbm - eof.

Best regards,

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Migrating to Harbour

Postby Maurizio » Fri Oct 04, 2013 6:45 am

Ciao Enrico

Did you read c:\Harbour\doc\xhb-diff.txt ?

Maurizio
www.nipeservice.com
User avatar
Maurizio
 
Posts: 823
Joined: Mon Oct 10, 2005 1:29 pm

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Fri Oct 04, 2013 8:27 am

Robb,

thank you. I'd prefer to keep using my compile batch. There are no problems in using /u+ to add hbcompat.ch to the default definition files. I just wanted to know if Harbour crew had provided an implicit definition for TRY/CATCH/END. Now I understood that they hadn't. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8704
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 21 guests

cron