Migrating to Harbour

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

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Maurizio,
Maurizio wrote:Ciao Enrico

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

Maurizio
http://www.nipeservice.com
Yes, I read it. What's your point?

EMG
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Migrating to Harbour

Post by Richard Chidiak »

Enrico

I have migrated a while ago to Harbour and Msvc , i use a lot of try/catch like below and i have no problems with it, i don't see the point.

TRY
oExcel := CREATEOBJECT( "Excel.Application" )
CATCH
MSGSTOP("L'Application Microsoft Excel n'est pas installée sur cet Ordinateur !" )
RETURN NIL
END

PS : I use Uestudio, in case it can help i join the make file

Hth

Richard

Code: Select all


# --------- Harbour y FWH configuration --------
# --- general --------------------------------------
# $P  - project name
# $Pp - path to project directory
# $Pn - project name
# --- compile --------------------------------------
# $I  - input full name
# $Ip - input path
# $In - input name
# $Ie - input extension
# $O  - output file
# $Op - path to output file
# $On - output filename (without path)
# $Oe - output extension
# $R  - release/debug setting for compiler
# --- build ----------------------------------------
# $T  - target full name
# $Tp - target path
# $Tn - target name
# $O  - output file
# $Op - path to output file
# $On - output filename (without path)
# $Oe - output extension
# $R  - release/debug setting for linker

[Settings]
Target = 
Category&01 = DEFAULT RUN CONFIGURATION
Working Directory =.
Command Line Arguments =

Category&02 = Harbour Options
Automatic Memvar Declaration = no|yes
Variables Are Assumed = no|yes
Generate Preprocessed Output = no|yes
Warning Level = 1|2|3|4|0
User Include Path =
User Defines =

Compiler Options =
Linker Options =

Excluded Files = Excludes

[SettingsInfo]
Target = Provides a space for you to specify an output file and location of the program that the linker creates.
Working Directory = Provides a space for you to specify the directory in which executing occurs. If you do not specify a directory, executing occurs in the directory where the executable is located.
Command Line Arguments = Provides a space for you to specify command-line arguments you want to pass to the program at startup.
Compiler Options = Provides a space for you to specify an additional compiler options.
User Defines = Shows the switches the tool will use to build. Use ';' as delimiter.
Linker Options = Provides a space for you to specify an additional linker options.
Excluded Files = This will exclude the file(s) included in this UE project group from the build.

[SettingsReps]
User Defines = @[;|-D%s]
Automatic Memvar Declaration = no=|yes=/a
Variables Are Assumed = no=|yes=/v
Generate Preprocessed Output = no=|yes=/p
User Include Path = ^^@[;|;%s]
User Include Path&1 = ^^@[;| /i%s]
Use Multi Thread Library = no|yes
Warning Level = @/w%s

[Variables]
FWH = c:\fwh
HPATH = c:\Harbour
CPATH = "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
CPATHIDE = C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
SDKPATH = "c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A"

HPATHL = $(HPATH)\LIB\win\msvc
CPATHL = $(CPATH)\LIB
SDKPATHL = $(SDKPATH)\LIB

HOPT = /n /gc0 /q $(Compiler Options) /i$(HPATH)\INCLUDE $(User Include Path&1) $(User Defines) $(Automatic Memvar Declaration) $(Variables Are Assumed) $(Generate Preprocessed Output) $(Warning Level)
COPT = -TP -W3 -c -I$(HPATH)\INCLUDE

LOPT = /nologo /subsystem:windows /force:multiple /NODEFAULTLIB:libc
LIBS1 = $(FWH)\LIB\FiveH32.lib $(FWH)\LIB\FiveHC32.lib 
LIBS2 = $(HPATHL)\hbrtl.lib $(HPATHL)\hbvm.lib $(HPATHL)\gtgui.lib $(HPATHL)\hblang.lib $(HPATHL)\hbmacro.lib $(HPATHL)\hbrdd.lib $(HPATHL)\rddntx.lib $(HPATHL)\rddcdx.lib $(HPATHL)\rddfpt.lib $(HPATHL)\hbsix.lib $(HPATHL)\hbdebug.lib $(HPATHL)\hbcommon.lib $(HPATHL)\hbpp.lib $(HPATHL)\xhb.lib $(HPATHL)\png.lib $(HPATHL)\hbzlib.lib $(HPATHL)\hbcpage.lib $(HPATHL)\hbwin.lib $(HPATHL)\hbct.lib $(HPATHL)\hbcplr.lib $(HPATHL)\hbpcre.lib $(HPATHL)\minizip.lib $(HPATHL)\hbziparc.lib $(HPATHL)\hbmzip.lib $(HPATHL)\hbtip.lib
LIBS3 = $(SDKPATHL)\kernel32.lib $(SDKPATHL)\user32.lib $(SDKPATHL)\gdi32.lib $(SDKPATHL)\winspool.lib $(SDKPATHL)\comctl32.lib $(SDKPATHL)\comdlg32.lib $(SDKPATHL)\advapi32.lib $(SDKPATHL)\shell32.lib $(SDKPATHL)\ole32.lib $(SDKPATHL)\oleaut32.lib $(SDKPATHL)\uuid.lib $(SDKPATHL)\odbc32.lib $(SDKPATHL)\odbccp32.lib $(SDKPATHL)\iphlpapi.lib $(SDKPATHL)\mpr.lib $(SDKPATHL)\version.lib $(SDKPATHL)\wsock32.lib $(SDKPATHL)\msimg32.lib $(SDKPATHL)\oledlg.lib $(SDKPATHL)\psapi.lib $(SDKPATHL)\gdiplus.lib $(SDKPATHL)\winmm.lib $(SDKPATHL)\WS2_32.LIB
LIBS = $(LIBS1) $(LIBS2) $(LIBS3)

[Environment]
PATH = $(HPATH)\BIN;$(CPATH)\BIN;$(SDKPATH)\BIN;$(CPATHIDE);%PATH%
INCLUDE = $(FWH)\INCLUDE;$(HPATH)\INCLUDE ;$(CPATH)\INCLUDE;$(SDKPATH)\INCLUDE
LIB = $(HPATHL);$(CPATHL);$(SDKPATHL);$(FWH)\LIB
BuildMode = %UESMode%

[General]
TargetExt = .EXE
ReleaseOut = Release
DebugOut = Debug
UseFullPaths = 1
UseDosNames = 0
Excludes = $(Excluded Files)
GenerateEDGroup=$(External Dependencies)
.CPP = .C

[MakeCommands]
run = Execute Application
makef = Show Makefile

[Execute Application]
Title = Execute $T
Cmd0 = $(Command Line Arguments)
Depends = $T
ShowWindow = 1
DisplayConsole = 0

[Show Makefile]
Title=Show makefile
Cmd0=uestudio makefile
ShowWindow=1
DisplayConsole=0

[InsertFiles]

[FileGroups]
FGO = .obj;
FGR = .res;
FGL = .lib;
FGD = .def;

[GroupFormats]
FGO = %s
FGR = %s
FGL = %s

[Build]
Out = $T
Depends = $FGO $FGR
DebugFlag = 
ReleaseFlag = 
Cmd0 = $(CPATH)\BIN\LINK $(LOPT) $FGO $FGR cfunchrb.obj $(LIBS1) $(LIBS2) $(LIBS4) "$(SDKPATHL)"\kernel32.lib "$(SDKPATHL)"\user32.lib "$(SDKPATHL)"\gdi32.lib "$(SDKPATHL)"\winspool.lib "$(SDKPATHL)"\comctl32.lib "$(SDKPATHL)"\comdlg32.lib "$(SDKPATHL)"\advapi32.lib "$(SDKPATHL)"\advapi32.lib "$(SDKPATHL)"\shell32.lib "$(SDKPATHL)"\ole32.lib "$(SDKPATHL)"\oleaut32.lib "$(SDKPATHL)"\uuid.lib "$(SDKPATHL)"\odbc32.lib "$(SDKPATHL)"\odbccp32.lib "$(SDKPATHL)"\iphlpapi.lib "$(SDKPATHL)"\mpr.lib "$(SDKPATHL)"\version.lib "$(SDKPATHL)"\wsock32.lib "$(SDKPATHL)"\msimg32.lib "$(SDKPATHL)"\oledlg.lib "$(SDKPATHL)"\psapi.lib "$(SDKPATHL)"\gdiplus.lib "$(SDKPATHL)"\winmm.lib "$(SDKPATHL)"\ws2_32.lib
[.PRG]
Out = $In.c
DebugFlag = /b
ReleaseFlag = 
Cmd0 = $(HPATH)\BIN\harbour $I $(HOPT) $R /o$O

IncFiles = 1
CaseSensitive = 0
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.

[.C]
Out = $In.obj
Cmd0 = $(CPATH)\BIN\cl.exe $(COPT) $I 

[.RC]
Out = $In.res
Cmd0 = $(SDKPATH)\bin\rc -r -fo$O $I

IncFiles = 1
CaseSensitive = 0
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.

 
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Richard,
Richard Chidiak wrote:Enrico

I have migrated a while ago to Harbour and Msvc , i use a lot of try/catch like below and i have no problems with it, i don't see the point.

TRY
oExcel := CREATEOBJECT( "Excel.Application" )
CATCH
MSGSTOP("L'Application Microsoft Excel n'est pas installée sur cet Ordinateur !" )
RETURN NIL
END
Harbour doesn't support TRY/CATCH/END structure.
Richard Chidiak wrote:PS : I use Uestudio, in case it can help i join the make file
I can't see anything related to TRY/CATCH/END in your configuration file. Please, can you address me to the right section of the file?

EMG
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Migrating to Harbour

Post by Richard Chidiak »

Enrico

I have this in my fivewin.ch (fwh 13.05)


#ifdef __HARBOUR__
#ifndef __XHARBOUR__
/*
static bError
#xcommand TRY => bError := errorBlock( {|oErr| break( oErr ) } ) ;;
BEGIN SEQUENCE
#xcommand CATCH [<!oErr!>] => errorBlock( bError ) ;;
RECOVER [USING <oErr>] <-oErr-> ;;
errorBlock( bError )
*/
#xcommand TRY => BEGIN SEQUENCE WITH {| oErr | Break( oErr ) }
#xcommand CATCH [<!oErr!>] => RECOVER [USING <oErr>] <-oErr->
#xcommand FINALLY => ALWAYS
#xtranslate Throw( <oErr> ) => ( Eval( ErrorBlock(), <oErr> ), Break( <oErr> ) )


#endif
#endif

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Richard,
Richard Chidiak wrote:Enrico

I have this in my fivewin.ch (fwh 13.05)
Ok, but I was speaking about console, pure Harbour, samples, no FWH involved. :-)

EMG
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Migrating to Harbour

Post by rhlawek »

The hbcompat.ch file maps TRY/CATCH to harbour's native BEGIN SEQUENCE/END SEQUENCE implementation, it isn't adding anything feature wise. I avoid using hbcompat.ch at all, I think I only have one .prg where I have to use it. I did find it useful to identify native harbour function names and calls. I used xhb.lib when I first began using harbour until I figured out its lay of the land. I stopped using it altogether, up until I introduced FiveWin to my environment, at which point I had to introduce in in the fwh.hbm module I shared. I haven't tried without it lately, that may have changed.

I suggest some caution in this regard as the fivewin installer includes a copy of hbcompat.ch, presumably direct from harbour source, but it is easy to wind up with a .ch file in the fivewin include directory that is not identical to what is current in harbour. I am careful to search for includes in harbour\include first, before fivewin\include, but even that has bitten me when harbour has a header with a conflicting name but different implementation is used in fivewin. My most recent favorite was dll.ch, which doesn't exist in harbour directly, but does exist in harbour\contribs\hbxpp. I spent way too many hours, and consumed a bit on Antonio's time. tracking that one down. I am NOT picking on fivewin here, the caution exists with any third party components, and it is not always immediately obvious that the condition exists.

I respect your decision to stick with batch files, I respect even more not wanting to disrupt a build system that works for you. I stuck with batch and mak files for many years, but once I realized what could be done with the harbour make system the reason to change was compelling, at least it was for me.

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

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Robb,
rhlawek wrote:I respect your decision to stick with batch files, I respect even more not wanting to disrupt a build system that works for you. I stuck with batch and mak files for many years, but once I realized what could be done with the harbour make system the reason to change was compelling, at least it was for me.
I don't need an external tool for compile. I develop it myself. :-)

EMG
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: Migrating to Harbour

Post by HunterEC »

Robb:

I've been following your post in this thread. I'm beggining to move from xHarbour / Borland C to Harbour / MSVC 2010. Can you post a simple example of a make file that checks and compile 2 PRGs ? Thank you.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Next problem: OLEDEFAULTARG(). I didn't find a replacement... :-(

I already tried to remove it.

EMG
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Migrating to Harbour

Post by Richard Chidiak »

Enrico

I use this in my main program

#ifndef __XHARBOUR__
FUNCTION DbSkipper( n ) ; RETURN __DbSkipper( n )
FUNCTION DbPack() ; RETURN __DbPack()
FUNCTION DbZap() ; RETURN hb_DbZap()
FUNCTION CurDrive( x ) ; RETURN hb_CurDrive( x )
#EndIf


Hth

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Richard,
Richard Chidiak wrote:Enrico

I use this in my main program

#ifndef __XHARBOUR__
FUNCTION DbSkipper( n ) ; RETURN __DbSkipper( n )
FUNCTION DbPack() ; RETURN __DbPack()
FUNCTION DbZap() ; RETURN hb_DbZap()
FUNCTION CurDrive( x ) ; RETURN hb_CurDrive( x )
#EndIf
Thank you. And what about OleDefaultArg(). This is a sample:

Code: Select all

FUNCTION MAIN()

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

    LOCAL cXls := "e:\harbour\mytest.xls"

    oExcel:WorkBooks:Open( cXls, , , OLEDEFAULTARG(), , , , OLEDEFAULTARG(), , , .T., , .T. )

    oExcel:Visible = .T.

    RETURN NIL
EMG
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Migrating to Harbour

Post by Richard Chidiak »

Enrico

OleDefaultArg()

is a shortcut to:

VTWrapper( VT_ERROR, DISP_E_PARAMNOTFOUND )

Here is the MSDN doc:

If an optional argument to an Automation method is left blank, do not pass a
VARIANT of type VT_EMPTY. Instead, pass a VARIANT of type VT_ERROR with a
value of DISP_E_PARAMNOTFOUND.

http://msdn.microsoft.com/en-us/library/ms221627.aspx

There is a lot on it on google, but for my own curiosity , is this function working with xharbour ? Not sure from what i read, i may be wrong.

Hth

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Migrating to Harbour

Post by rhlawek »

HunterEC,

Yes, please post, I will help with what I can. But I'd prefer we don't hijack Enrico's thread, would you please start another regarding build options for harbour. I suspect there will be many responses, I don't assert that my is any any better than anybody else's, but once I got where I am I could stop worrying with how I was going get something to build and focus on the new code I wish to write. I made several aborted attempts at the transition from xharbour to harbour, and I had an equally high number of aborted attempts to transition from Visual xHarbour to FWH. Those already comfortably at home with FWH probably don't have much interest in this, but for those I presume are attempting what I attempted and not only accomplished, but ended up with something beyond what I had expected. In retrospect it has been a very worthwhile effort.

I do wish to make a specific note here. I speak no ill of xHarbour, I hold xHarbour in the highest regard. It was a marvelous discovery that bridged a wide gap between Clipper and the modern world. I actively use it, it was the product that removed Clipper from my desktop, and continue to have several apps that have been running since their original releases from many years ago, and will continue to run fine into the foreseeable future, they are absolutely rock solid. But there were some specific things xHarbour wasn't going to deliver, or at least not in the time frame I needed a solution to some very specific problems.

Robb
Post Reply