Visual interface for Harbour hbmk2.exe

Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Sun Mar 17, 2013 10:32 pm

Harbour provides a powerfull hbmk2.exe make utility but it is intended to be used from a console window, so I thought to provide a visual interface for it to turn it even simpler :-)

This is a very early prototype but you may be interested in testing it, provide ideas, etc. thanks

vhb.prg
Code: Select all  Expand view
#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function BuildWindow()

   local oDlg, oGet1, cPrgName := Space( 20 ), oSay3, oFld1, oSay2, oBtn1, oBtn2
   local cResult, oResult, cPath, nRetCode

   SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )
   
   DEFINE DIALOG oDlg TITLE "Visual make for Harbour" ;
      SIZE 600, 500

   @ 16,  16 SAY oSay2 PROMPT "Main PRG" SIZE  30, 9 PIXEL OF oDlg

   @ 25, 16 GET oGet1 VAR cPrgName SIZE 120, 12 PIXEL OF oDlg ;
      ACTION oGet1:VarPut( cGetFile( "*.prg" ) )

   @ 50,  16 SAY oSay3 PROMPT "Additional" SIZE 30, 9 PIXEL OF oDlg

   @ 60, 16 FOLDER oFld1 PROMPTS "PRGs", "OBJs", "LIBs" ;
      SIZE 200, 100 PIXEL OF oDlg

   @ 22, 230 BUTTON oBtn1 PROMPT "&Build" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION ( MemoWrit( "go.bat", "set path=c:\bcc582\bin" + CRLF + ;
                                   "c:\harbour\bin\hbmk2 " + ;
                                   "-comp=bcc " + ;
                                   "-ic:\fwteam\include " + ;
                                   "-lfiveh.lib " + ;
                                   "-lfivehc.lib " + ;
                                   "-Lc:\fwteam\lib " + ;
                                   "-lc:\bcc582\lib\psdk\psapi.lib " + ;
                                   "xhb.hbc " + ;
                                   "-gtgui " + ;
                                   AllTrim( cPrgName ) ),;
               nRetCode := WaitRun( "go.bat > out.log", 0 ),;
               oResult:SetText( GetError( nRetCode ) + CRLF + MemoRead( "out.log" ) ),;
               WaitRun( cFileNoExt( cPrgName ) ),;
               hb_SetEnv( "path", cPath ) )

   @ 48, 230 BUTTON oBtn2 PROMPT "&Cancel" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION oDlg:End()

   @ 170, 16 SAY oSay3 PROMPT "Result" SIZE 30, 9 PIXEL OF oDlg

   @ 180, 16 GET oResult VAR cResult MEMO ;
      SIZE 200, 60 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED

return oDlg

//----------------------------------------------------------------------------//

function GetError( nError )

   do case
      case nError == 0
           return "Ok"
   
      case nError == 2
           return "unknown compiler"
           
      case nError == 6
           return "failed in compilation (Harbour, C compiler, Resource compiler)"
         
      case nError == 7
           return "failed in final assembly (linker or library manager)"        
         
   endcase
   
return Str( nError )

//----------------------------------------------------------------------------//          

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby Massimo Linossi » Mon Mar 18, 2013 8:34 am

WOW. This is really great.
If you can finish this project and add all the RMDBFCDX functionality, I can switch from Xharbour.com to your version.
Many thanks Antonio.
Massimo
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Mon Mar 18, 2013 9:03 am

Enhanced version with multiple PRGs support:

Image

vhb.prg
Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

static oBrwPrgs, aPrgs := { { "", "", "" } }

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oGetName, cPrgName := Space( 20 ), oFldAdditional
   local oBtnBuild, oBtnCancel
   local cResult, oResult, cPath, nRetCode

   SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )
   
   DEFINE DIALOG oDlg TITLE "Visual make for Harbour" ;
      SIZE 600, 500

   @ 16,  16 SAY "Main PRG" SIZE  30, 9 PIXEL OF oDlg

   @ 25, 16 GET oGetName VAR cPrgName SIZE 120, 12 PIXEL OF oDlg ;
      ACTION oGetName:VarPut( cGetFile( "*.prg" ) )

   @ 50,  16 SAY "Additional" SIZE 30, 9 PIXEL OF oDlg

   @ 60, 16 FOLDER oFldAdditional PROMPTS "PRGs", "OBJs", "LIBs" ;
      SIZE 200, 100 PIXEL OF oDlg

   BuildBrwPrgs( oFldAdditional )

   @ 22, 230 BUTTON oBtnBuild PROMPT "&Build" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION ( MemoWrit( "go.bat", "set path=c:\bcc582\bin" + CRLF + ;
                                   "c:\harbour\bin\hbmk2 " + ;
                                   "-comp=bcc " + ;
                                   "-ic:\fwteam\include " + ;
                                   "-lfiveh.lib " + ;
                                   "-lfivehc.lib " + ;
                                   "-Lc:\fwteam\lib " + ;
                                   "-lc:\bcc582\lib\psdk\psapi.lib " + ;
                                   "xhb.hbc " + ;
                                   "-gtgui " + ;
                                   AllTrim( cPrgName ) + ;
                                   AToStr( aPrgs ) ),;
               nRetCode := WaitRun( "go.bat > out.log", 0 ),;
               oResult:SetText( GetError( nRetCode ) + CRLF + MemoRead( "out.log" ) ),;
               WaitRun( cFileNoExt( cPrgName ) ) )

   @ 48, 230 BUTTON oBtnCancel PROMPT "&Cancel" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION oDlg:End()

   @ 170, 16 SAY "Result" SIZE 30, 9 PIXEL OF oDlg

   @ 180, 16 GET oResult VAR cResult MEMO ;
      SIZE 200, 60 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT BuildFldButtons( oFldAdditional )

return oDlg

//----------------------------------------------------------------------------//

function GetError( nError )

   do case
      case nError == 0
           return "Ok"
   
      case nError == 1
           return "unknown platform"
   
      case nError == 2
           return "unknown compiler"
           
      case nError == 3
           return "failed Harbour detection"    
           
      case nError == 5
           return "failed stub creation"    
           
      case nError == 6
           return "failed in compilation (Harbour, C compiler, Resource compiler)"
         
      case nError == 7
           return "failed in final assembly (linker or library manager)"        
         
      case nError == 8
           return "unsupported"  
         
      case nError == 9
           return "failed to create working directory"  
         
      case nError == 10
           return "dependency missing or disabled"  
         
      case nError == 19
           return "help"  
         
      case nError == 20
           return "plugin initialization"
           
      case nError == 30
           return "too deep nesting"    
           
      case nError == 50
           return "stop requested"    
   endcase
   
return Str( nError )

//----------------------------------------------------------------------------//

function BuildBrwPrgs( oFld )

   @ 0, 0 XBROWSE oBrwPrgs ARRAY aPrgs SIZE 300, 180 PIXEL OF oFld:aDialogs[ 1 ]

   // oBrwPrgs:SetFont( ::oFontBrw )

   ADD TO oBrwPrgs HEADER "Name" DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 1 ] SIZE 200
   ADD TO oBrwPrgs HEADER "Size" DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 2 ] SIZE  80
   ADD TO oBrwPrgs HEADER "Date" DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 3 ] SIZE  70

   oBrwPrgs:nMarqueeStyle = MARQSTYLE_HIGHLROW
   oBrwPrgs:nRowHeight    = 17
   oBrwPrgs:bClrSel       = { || { CLR_WHITE, CLR_BLUE } }

   oBrwPrgs:CreateFromCode()

   oFld:aDialogs[ 1 ]:SetControl( oBrwPrgs )
   
return oBrwPrgs

//----------------------------------------------------------------------------//

function BuildFldButtons( oFld )

   local cMask  := { "*.prg", "*.obj", "*.lib" }[ oFld:nOption ]
   local cTitle := "Please select a " + { "PRG", "OBJ", "LIB" }[ oFld:nOption ] + " file"
   local oBtn, cFileName

   @ 1, 350 BUTTON oBtn PROMPT "+" OF oFld SIZE 18, 18 PIXEL ;
      ACTION ( cFileName := cGetFile( cMask, cTitle ),;
               If( ! Empty( cFileName ),;
                   ( If( aPrgs[ 1 ][ 1 ] == "", ASize( aPrgs, 0 ),),;
                     AAdd( aPrgs, { cFileName, Directory( cFileName )[ 1 ][ 2 ],;
                                    Directory( cFileName )[ 1 ][ 3 ] } ),;
                     oFld:aDialogs[ 1 ]:aControls[ 1 ]:GoBottom(),;
                     oFld:aDialogs[ 1 ]:aControls[ 1 ]:SetFocus() ), ) )

   oBtn:cTooltip = "Add"

   @ 1, 372 BUTTON "--" OF oFld SIZE 18, 18 PIXEL

return nil

//----------------------------------------------------------------------------//

function AToStr( aFiles )

   local cResult := ""
   
   AEval( aFiles, { | aFile | cResult += " " + aFile[ 1 ] } )
   
return cResult

//----------------------------------------------------------------------------//                    
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Mon Mar 18, 2013 9:48 am

We start the settings implementation:

Image

vmh.prg
Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

static oBrwPrgs, aPrgs := { { "", "", "" } }
static cHbmkPath := "c:\harbour\bin\hbmk2.exe"
static cCCompiler := "Borland"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oGetName, cPrgName := Space( 20 ), oFldAdditional
   local oBtnBuild, oBtnCancel
   local cResult, oResult, cPath, nRetCode

   SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )
   
   DEFINE DIALOG oDlg TITLE "Visual make for Harbour" ;
      SIZE 600, 500

   @ 16,  16 SAY "Main PRG" SIZE  30, 9 PIXEL OF oDlg

   @ 25, 16 GET oGetName VAR cPrgName SIZE 120, 12 PIXEL OF oDlg ;
      ACTION oGetName:VarPut( cGetFile( "*.prg" ) ) ;
      VALID If( Empty( cPrgName ), ( MsgAlert( "please select a PRG file" ), .F. ), .T. )

   @ 50,  16 SAY "Additional" SIZE 30, 9 PIXEL OF oDlg

   @ 60, 16 FOLDER oFldAdditional PROMPTS "PRGs", "OBJs", "LIBs" ;
      SIZE 200, 100 PIXEL OF oDlg

   BuildBrwPrgs( oFldAdditional )

   @ 22, 230 BUTTON oBtnBuild PROMPT "&Build" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION ( If( ! File( "c:\harbour\bin\hbmk2.exe" ), MsgAlert( "can't find hbmk2.exe" ),),;
               MemoWrit( "go.bat", "set path=c:\bcc582\bin" + CRLF + ;
                                   cHbmkPath + " " + ;
                                   "-comp=" + If( cCCompiler == "Borland", "bcc", "" ) + ;
                                   If( cCCompiler == "Microsoft", "msvc", "" ) + ;
                                   If( cCCompiler == "MinGW", "mingw", "" ) + " " + ;
                                   "-ic:\fwteam\include " + ;
                                   "-lfiveh.lib " + ;
                                   "-lfivehc.lib " + ;
                                   "-Lc:\fwteam\lib " + ;
                                   "-lc:\bcc582\lib\psdk\psapi.lib " + ;
                                   "xhb.hbc " + ;
                                   "-gtgui " + ;
                                   AllTrim( cPrgName ) + ;
                                   AToStr( aPrgs ) ),;
               nRetCode := WaitRun( "go.bat > out.log", 0 ),;
               oResult:SetText( GetError( nRetCode ) + CRLF + MemoRead( "out.log" ) ),;
               If( nRetCode == 0, WaitRun( cFileNoExt( cPrgName ) ),) )

   @ 48, 230 BUTTON oBtnCancel PROMPT "&Cancel" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION oDlg:End() CANCEL

   @ 74, 230 BUTTON "&Settings..." ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION ( Settings(), oGetName:SetFocus() ) CANCEL

   @ 170, 16 SAY "Result" SIZE 30, 9 PIXEL OF oDlg

   @ 180, 16 GET oResult VAR cResult MEMO ;
      SIZE 200, 60 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT BuildFldButtons( oFldAdditional )

return oDlg

//----------------------------------------------------------------------------//

function GetError( nError )

   do case
      case nError == 0
           return "Ok"
   
      case nError == 1
           return "unknown platform"
   
      case nError == 2
           return "unknown compiler"
           
      case nError == 3
           return "failed Harbour detection"    
           
      case nError == 5
           return "failed stub creation"    
           
      case nError == 6
           return "failed in compilation (Harbour, C compiler, Resource compiler)"
         
      case nError == 7
           return "failed in final assembly (linker or library manager)"        
         
      case nError == 8
           return "unsupported"  
         
      case nError == 9
           return "failed to create working directory"  
         
      case nError == 10
           return "dependency missing or disabled"  
         
      case nError == 19
           return "help"  
         
      case nError == 20
           return "plugin initialization"
           
      case nError == 30
           return "too deep nesting"    
           
      case nError == 50
           return "stop requested"    
   endcase
   
return Str( nError )

//----------------------------------------------------------------------------//

function BuildBrwPrgs( oFld )

   @ 0, 0 XBROWSE oBrwPrgs ARRAY aPrgs SIZE 300, 180 PIXEL OF oFld:aDialogs[ 1 ]

   // oBrwPrgs:SetFont( ::oFontBrw )

   ADD TO oBrwPrgs HEADER "Name" DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 1 ] SIZE 200
   ADD TO oBrwPrgs HEADER "Size" DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 2 ] SIZE  80
   ADD TO oBrwPrgs HEADER "Date" DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 3 ] SIZE  70

   oBrwPrgs:nMarqueeStyle = MARQSTYLE_HIGHLROW
   oBrwPrgs:nRowHeight    = 17
   oBrwPrgs:bClrSel       = { || { CLR_WHITE, CLR_BLUE } }

   oBrwPrgs:CreateFromCode()

   oFld:aDialogs[ 1 ]:SetControl( oBrwPrgs )
   
return oBrwPrgs

//----------------------------------------------------------------------------//

function BuildFldButtons( oFld )

   local cMask  := { "*.prg", "*.obj", "*.lib" }[ oFld:nOption ]
   local cTitle := "Please select a " + { "PRG", "OBJ", "LIB" }[ oFld:nOption ] + " file"
   local oBtn, cFileName

   @ 1, 350 BUTTON oBtn PROMPT "+" OF oFld SIZE 18, 18 PIXEL ;
      ACTION ( cFileName := cGetFile( cMask, cTitle ),;
               If( ! Empty( cFileName ),;
                   ( If( aPrgs[ 1 ][ 1 ] == "", ASize( aPrgs, 0 ),),;
                     AAdd( aPrgs, { cFileName, Directory( cFileName )[ 1 ][ 2 ],;
                                    Directory( cFileName )[ 1 ][ 3 ] } ),;
                     oFld:aDialogs[ 1 ]:aControls[ 1 ]:GoBottom(),;
                     oFld:aDialogs[ 1 ]:aControls[ 1 ]:SetFocus() ), ) )

   oBtn:cTooltip = "Add"

   @ 1, 372 BUTTON "--" OF oFld SIZE 18, 18 PIXEL

return nil

//----------------------------------------------------------------------------//

function AToStr( aFiles )

   local cResult := ""
   
   AEval( aFiles, { | aFile | cResult += " " + aFile[ 1 ] } )
   
return cResult

//----------------------------------------------------------------------------//

function Settings()

   local oDlg, oHbmkPath, cMakePath := cHbmkPath
   local cCompiler := cCCompiler
   
   DEFINE DIALOG oDlg TITLE "Settings" SIZE 500, 400
   
   @ 15, 16 SAY "hbmk2.exe path" OF oDlg SIZE 80, 10 PIXEL

   @ 25, 16 GET oHbmkPath VAR cMakePath SIZE 120, 12 PIXEL OF oDlg ;
      ACTION oHbmkPath:VarPut( cGetFile( cHbmkPath ) ) ;
      VALID If( Empty( cHbmkPath ), ( MsgAlert( "please select hbmk2.exe path" ), .F. ), .T. )

   @ 49, 16 SAY "C compiler" OF oDlg SIZE 80, 10 PIXEL

   @ 59, 16 COMBOBOX oCbx VAR cCompiler ITEMS { "Borland", "Microsoft", "MinGW" } ;
      OF oDlg SIZE 120, 100 PIXEL

   @ 22, 180 BUTTON "&Save" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION ( cHbmkPath := cMakePath, cCCompiler := cCompiler, oDlg:End() )

   @ 48, 180 BUTTON "&Cancel" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION oDlg:End() CANCEL
   
   ACTIVATE DIALOG oDlg CENTERED
   
return nil

//----------------------------------------------------------------------------//                      
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Mon Mar 18, 2013 10:11 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby Patrick Mast » Mon Mar 18, 2013 10:53 am

Hey Massimo,
Massimo Linossi wrote:WOW. This is really great.If you can finish this project and add all the RMDBFCDX functionality, I can switch from Xharbour.com to your version.

Just out of curiosity, why would you switch from xHarbour?

If RMDBFCDX for Harbour would be available from xHarbour.com, would you be interested?

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Re: Visual interface for Harbour hbmk2.exe

Postby Massimo Linossi » Mon Mar 18, 2013 11:45 am

Hello Patrick.
First of all because a lot of times, when I upgrade to the new builder version there are some problems with libraries and FWH.
I'm using the professional version, not the Enterprise. So I don't need the SQL extensions.
The most useful functions that I'm using, for their speed, are inside the RMDBFCDX. The Rushmore technology used is really
great. But is only there, and for this reason I'm still using the xharbour.com
If there would be a version for harbour of RMDBFCDX, I would make a transition.
Massimo
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: Visual interface for Harbour hbmk2.exe

Postby elvira » Mon Mar 18, 2013 7:03 pm

Patrick,

Just out of curiosity, why would you switch from xHarbour?


Just take a look at Harbour´s changelog to see progress. Also, you do not provide new features.

Why should stay at xHarbour.com and have on every update issues?.

Hope it helps you to improve the company.
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Mon Mar 18, 2013 9:04 pm

Here you have an enhanced version with optional support for FiveWin:

https://code.google.com/p/fivewin-contributions/downloads/detail?name=vmh_20130318.zip&can=2&q=
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Tue Mar 19, 2013 8:58 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby byte-one » Tue Mar 19, 2013 11:23 am

Antonio, good work! You should also add support for C-files!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Tue Mar 19, 2013 3:11 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Tue Mar 19, 2013 3:31 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby Antonio Linares » Tue Mar 19, 2013 4:18 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Visual interface for Harbour hbmk2.exe

Postby byte-one » Tue Mar 19, 2013 5:32 pm

Antonio, I think *.cpp should also applicable!? (with the right mode from the C-Compiler)´

And variable settings for different projects. :)
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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