Converter

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
ruben
Posts: 5
Joined: Tue Jan 08, 2013 10:40 am

Converter

Post by ruben »

Hi to all :)
I have few questions..

1.is there a converter who can translate HMG or xHarbour code to C ?
2.Which version of HMG work with Borland Bcc51 compiler ?

thanks...
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Converter

Post by mol »

I don't know converter from harbour to C, but, if you compile program via HMG IDE, you can find .hbmk subfolder containing C files.

HMG is based on mingw compiler, not on Borland C.
You can search Santy's post about porting to Borland C 5.8.2 compiler
viewtopic.php?f=15&t=2656
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Converter

Post by esgici »

ruben wrote:Hi to all :)
I have few questions..

1.is there a converter who can translate HMG or xHarbour code to C ?
2.Which version of HMG work with Borland Bcc51 compiler ?

thanks...
Hi Ruben

Welcome aboard :)

Salute from Turkiye :)

1. Harbour always convert .prg to .c. Please
- see hbmk2 help ( hbmk2 -help ) for -p switch or
- search "ppo" in Harbour Users / developper news groups :
https://groups.google.com/forum/?fromgr ... bour-users
https://groups.google.com/forum/?fromgr ... bour-devel
or hmgforum.
Note : .ppo file may be a little different than expected ;)
2. Please look at here :
viewtopic.php?f=15&t=2656&p=23711#p23711

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
klauskugel
Posts: 90
Joined: Tue Oct 09, 2012 2:28 pm

Re: Converter

Post by klauskugel »

Hi, ruben.

This is the mere Harbour-Functionality.
But this Inner-Knowledge is not needed for the
normal Programming of Harbour/Clipper-Language and HMG.
It might give a hint of the Compilers inner life and
how things are handled in Lexical and syntactical analysis.
Hope my explanation helps somewhat.
It is not necessary for Harbour-User Programming !
I hope, that I could explain it appropriate enough.
With my little knowledge of Compiler-Interna.
The creators of harbour are miles beyond me.


test2.prg

function main -> HB_FUNC( MAIN );

@ 0,0 clear -> HB_FUNC_EXTERN( SCROLL );
@ 5,5 say "Hello World" -> HB_FUNC_EXTERN( SETPOS );HB_FUNC_EXTERN( DEVPOS );HB_FUNC_EXTERN( DEVOUT );

return nil

// compile via Harbour -gc3 test2.prg instead of default 0 see Harbour -gc command
// -> the output is test2.c
//as follows for the target compiler Gnu C 4.7.1

// Program contains table for Harbour functions
// for Virtual memory setup "hbvmpub.h"
// the PCode used in PPO-Files -> PCode-Interpreter "hbpcode.h" - Table of Harbour functions
// Startup initialization routines. "hbinit.h"


/*
* Harbour 3.2.0dev (Rev. 17984)
* GNU C 4.7.1 (64-bit)
* Generated C source from "test2.prg"
*/

#include "hbvmpub.h"
#include "hbpcode.h"
#include "hbinit.h"
#include "hbxvm.h"


HB_FUNC( TEST2 );
HB_FUNC( MAIN );
HB_FUNC_EXTERN( SCROLL );
HB_FUNC_EXTERN( SETPOS );
HB_FUNC_EXTERN( DEVPOS );
HB_FUNC_EXTERN( DEVOUT );


HB_INIT_SYMBOLS_BEGIN( hb_vm_SymbolInit_TEST2 )
{ "TEST2", {HB_FS_PUBLIC | HB_FS_FIRST | HB_FS_LOCAL}, {HB_FUNCNAME( TEST2 )}, NULL },
{ "MAIN", {HB_FS_PUBLIC | HB_FS_LOCAL}, {HB_FUNCNAME( MAIN )}, NULL },
{ "SCROLL", {HB_FS_PUBLIC}, {HB_FUNCNAME( SCROLL )}, NULL },
{ "SETPOS", {HB_FS_PUBLIC}, {HB_FUNCNAME( SETPOS )}, NULL },
{ "DEVPOS", {HB_FS_PUBLIC}, {HB_FUNCNAME( DEVPOS )}, NULL },
{ "DEVOUT", {HB_FS_PUBLIC}, {HB_FUNCNAME( DEVOUT )}, NULL }
HB_INIT_SYMBOLS_EX_END( hb_vm_SymbolInit_TEST2, "test2.prg", 0x0, 0x0003 )

#if defined( HB_PRAGMA_STARTUP )
#pragma startup hb_vm_SymbolInit_TEST2
#elif defined( HB_DATASEG_STARTUP )
#define HB_DATASEG_BODY HB_DATASEG_FUNC( hb_vm_SymbolInit_TEST2 )
#include "hbiniseg.h"
#endif

HB_FUNC( TEST2 )
{
do {
/* *** END PROC *** */
} while( 0 );
}

HB_FUNC( MAIN )
{
do {
hb_xvmSetLine( 3 );
hb_xvmPushFuncSymbol( symbols + 2 );
hb_xvmPushInteger( 0 );
hb_xvmPushInteger( 0 );
if( hb_xvmDo( 2 ) ) break;
hb_xvmPushFuncSymbol( symbols + 3 );
hb_xvmPushInteger( 0 );
hb_xvmPushInteger( 0 );
if( hb_xvmDo( 2 ) ) break;
hb_xvmSetLine( 4 );
hb_xvmPushFuncSymbol( symbols + 4 );
hb_xvmPushInteger( 5 );
hb_xvmPushInteger( 5 );
if( hb_xvmDo( 2 ) ) break;
hb_xvmPushFuncSymbol( symbols + 5 );
hb_xvmPushStringConst( "Hello World", 11 );
if( hb_xvmDo( 1 ) ) break;
hb_xvmSetLine( 6 );
hb_xvmRetNil();
/* *** END PROC *** */
} while( 0 );
}
User avatar
ruben
Posts: 5
Joined: Tue Jan 08, 2013 10:40 am

Re: Converter

Post by ruben »

thanks on reply...
I ask this in first place because i have sources of one interpreter 'nova'
written in Harbour files .prg and i wonder is there a way to translate them
into C for faster execution (speed up) things...
Every harbour compiled exe depend on harbour virtual machine execution,right?
so i think that on this way things are work far faster..
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Converter

Post by esgici »

Hi Ruben
ruben wrote:thanks on reply...
I ask this in first place because i have sources of one interpreter 'nova'
written in Harbour files .prg and i wonder is there a way to translate them
into C for faster execution (speed up) things...
Every harbour compiled exe depend on harbour virtual machine execution,right?
so i think that on this way things are work far faster..
Yes, AFAIK Harbour compiled exes runs in VM.

I don't know anything about "interpreter 'nova written in Harbour files .prg"
But Harbour has a wonderful interpreter in standard distribution : hb_run.

Regards
Viva INTERNATIONAL HMG :D
User avatar
ruben
Posts: 5
Joined: Tue Jan 08, 2013 10:40 am

Re: Converter

Post by ruben »

Hi..
You probably know it is 'supernova' created in PWCT,right?
Ok i will try compile each file and will see what i will get..
thanks again on respond ;)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Converter

Post by esgici »

ruben wrote:Hi..
You probably know it is 'supernova' created in PWCT,right?
Ok i will try compile each file and will see what i will get..
thanks again on respond ;)
Oh, yes; PWCT !

Thanks to reminding :)

Regards
Viva INTERNATIONAL HMG :D
User avatar
ruben
Posts: 5
Joined: Tue Jan 08, 2013 10:40 am

Re: Converter

Post by ruben »

Yes pwct,but i don't have in plan use it because i found this way of programming to
strange and weird to me.

I also found that i cannot open with HMG IDE single .prg file... :?:
Is there a way that i can do this?
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Converter

Post by mol »

you should create .hbp file containing list of .prg modules. Such a file you can open with Hmg IDE
Post Reply