Switching from xHarbour to Harbour

Switching from xHarbour to Harbour

Postby Jeff Barnes » Fri Sep 28, 2012 10:14 pm

I am looking to switch from xHarbour to Harbour and was wondering if there is a list of things I need to watch out for ?
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Switching from xHarbour to Harbour

Postby nageswaragunupudi » Sat Sep 29, 2012 3:34 am

Very simple.

Please add #include "hbcompat.ch" at the top of every module and link xhb.lib in the link script. Mostly this is what all that needs to be done.

However very few incompatibles remain.
Negative array indexes which work in XHarbour do not work in Harbour.
Eg: You need to change aData[ -1 ] as ATail( aData ),
aData[ -n ] as aData[ Len( aData ) - n + 1 ]

In case you have used array type of indexes to Character variables you need to convert them as SubStr.

Except these two, everythingelse should work well with Harbour.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10251
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Switching from xHarbour to Harbour

Postby Franklin Demont » Sat Sep 29, 2012 8:04 am

Jeff Barnes wrote:I am looking to switch from xHarbour to Harbour and was wondering if there is a list of things I need to watch out for ?

Jeff ,

I have finished the conversion , a big aplication (+/- 30 prg-files , i worked on it during a month) . The goal is to have a aplication that can be build with xharbour and harbour.

I will try to give the problems which i had , hopely this day

Some problems can you find in this forum the last days

Frank
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Switching from xHarbour to Harbour

Postby Franklin Demont » Sat Sep 29, 2012 1:32 pm

Franklin Demont wrote:
Jeff Barnes wrote:I am looking to switch from xHarbour to Harbour and was wondering if there is a list of things I need to watch out for ?

Jeff ,

I have finished the conversion , a big aplication (+/- 30 prg-files , i worked on it during a month) . The goal is to have a aplication that can be build with xharbour and harbour.

I will try to give the problems which i had , hopely this day

Some problems can you find in this forum the last days

Frank


1) As xMate user i searched for a envirronement-file in the forum :
viewtopic.php?f=3&t=22823&p=127863&hilit=xmate+harbour#p127863
HB_COMMAND should not define __HARBOUR__ , it is defined in the compiler

2) In each program module :

# ifdef __HARBOUR__
# ifndef __XHARBOUR__
# include "xhb.ch"
# include "xhbcls.ch"
# INCLUDE "xset.ch" // From xharbour , in include
# define ATAILh(Arr) Arr[LEN(Arr)]
# endif
# endif

xSet.ch : Missing defines from set.ch (HARBOUR) , i.e. _SET_ERRORLOG_
ATAILh(Arr) : Xharbour accepts ATAIL(Arr) := ..... , HARBOUR doesn't
You have to search manually this cases and change in ATAILh(arr) (case sensitive)
(or compile and search the lines with the error)
IN mine case i had also ATAIL(Arr[n]) , i used ATAILH(Arr,n) Arr[n,LEN(Arr[n])]

3) PREDEFINES

IF x IN y must be IF (x IN y)

I had also problems with (try to remember):
WITH OBJECT obj
SomeArr[:Someproperty] ==> SomeArr[Obj:SomeProperty]
END

4) Xharbour has no problems with (faulty) expressions as :
obrw:bPastEof()
oDlg:end
It can be very dificult to find such error , see viewtopic.php?f=3&t=24820#p134633

5) See also viewtopic.php?f=3&t=24902#p135294
INIT module can not have xharbout extensions

6) The bigest problem is GLOBAL and GLOBAL EXTERNAL variables from xharbour. See the sample.
To test create 3 prg-files as indicated , in xharbour globalvar.prg is not linked in
Code: Select all  Expand view

// Mainmodule , first prg-file
# include "FiveWin.ch"
# ifdef __HARBOUR__
# ifndef __XHARBOUR__
# include "xhb.ch"
# define _oWnd    g():oWnd
# else    // __XHARBOUR__
GLOBAL _oWnd
# endif   // __XHARBOUR__
# endif
PROC MAIN
**********
DEFINE WINDOW _oWnd FROM 0, 0 TO 24, 80 MDI;
MENU BuildMenu()
ACTIVATE WINDOW _oWnd MAXIMIZED
RETURN
function BuildMenu()
************************
local oMenu
LOCAL oMenuItem
MENU oMenu
 MENUITEM "Dialog from Main window";
       ACTION TestDlg()
ENDMENU
RETURN oMenu
***********************************************************************
//DIALOG.PRG , second prg-file
# include "FiveWin.ch"
# ifdef __HARBOUR__
# ifndef __XHARBOUR__
# include "xhb.ch"
# define _oWnd    g():oWnd
# else    // __XHARBOUR__
GLOBAL EXTERNAL _oWnd
# endif   // __XHARBOUR__
# endif
PROC TestDlg()
**************
LOCAL oDlg
DEFINE DIALOG oDlg OF _oWnd FROM 0, 0 TO 20, 60
ACTIVATE DIALOG oDlg
RETURN
***********************************************************************
//GLOBALVAR.PRG  third prg-file , only linked in with HARBOUR
# include "FiveWin.ch"
# ifdef __HARBOUR__
# include "xhb.ch"
STATIC g
# endif
class GlobalVar
***************
VAR oWnd
END CLASS
***************
Function g()
***********
RETURN g
 


7) Associative arrays
See viewtopic.php?f=3&t=24919#p135460
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 17 guests