Page 1 of 1

xHarbour 1.2.3 (Build 20130117) with MSVC 2013 Express

PostPosted: Thu Aug 07, 2014 3:11 am
by fafi
Hi.. All
Please test...


xcompiler.prg
Code: Select all  Expand view


#include "FiveWin.ch"
//----------------------------------------------------------------------------//

function Main()

   local oText
   local n,xFile
   local cFile,i,aFile,nLenFile,aPRGFile
   local cFileRC  := ""
     local nPRGFile := 0
     local nRCFile  := 0,nLen,oDlgCompile
     
   if !file("prg.tmp")
      ?"File prg.tmp not found"
      return nil
   endif
   
   ClearFileCompiler()
   
   if file("prg.tmp")
           oText := TTxtFile():New( "prg.tmp" )
           nLenFile := oText:RecCount()
           aFile := {}
           for n = 1 to nLenFile
              cFile :=  upper(alltrim(oText:ReadLine()))
              if !empty(cFile)
             
                      if file(cFile)
                         aadd(aFile,cFile)
                      else
                         ?"File "+cFile+" not found"
                         return nil  
                      endif
             
              endif
              oText:Skip()
           next
           oText:Close()
   endif
   
   if len(aFile) == 0
      ?"Empty list prg"
      return nil
   endif
   
   oText := TTxtFile():New( "compile.bat" )
   
   if oText:Open()
            oText:Add( "@ECHO OFF")
            oText:Add( "CLS")
            oText:Add( "ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿")
            oText:Add( "ECHO ³ FiveWin for xHarbour 1.2.3 Intl. (SimpLex) (Build 20130117)                ³Ü")
            oText:Add( "ECHO ³ Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86      ³Ü")
            oText:Add( "ECHO ³ (c) FiveTech, 1993-2013  for Microsoft Windows 9x/NT/2000/ME/XP/Vista/7/8  ³Û")
            oText:Add( "ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ")
            oText:Add( "ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß")
            oText:Add( "")
            oText:Add( "del mvc.log")
            oText:Add( "")
            oText:Add( "")
            oText:Add( "ECHO Compiling...")
            oText:Add( "")
            oText:Add( "set hdir=d:\mvc2013\xharbour")
            oText:Add( "set vcdir=d:\mvc2013")
            oText:Add( "set include=%vcdir%\include;%hdir%\include;%include%")
            oText:Add( "set lib=%vcdir%\lib;%hdir%\lib;%lib%")
            oText:Add( "")
            cFileRC := ""
            nPRGFile := 0
            nRCFile  := 0
            aPRGFile := {}
            for n := 1 to len(aFile)
               cFile := upper(alltrim(aFile[n]))
               nLen := len(cFile)
               if upper(right(cFile,2)) == "RC"
                  cFileRC := left(cFile,nLen-3)
                  ++nRCFile
               endif
               if upper(right(cFile,3)) == "PRG"
                  ++nPRGFile
                  cFile := left(cFile,nLen-4)
                  aadd(aPRGFile,cFile)
               endif  
            next
           
            if nRCFile > 1
              oText:Close()
          ?"Too many rc files.."
              ClearFileCompiler()
              return nil
            endif
           
            // XHARBOUR COMPILER
           
            if nPRGFile == 1
               cFile := aPRGFile[1]
               if !file(cFile+".prg")
                  oText:Close()
                  ?"File "+cFile+".prg not found"
                  ClearFileCompiler()
                  return nil
               endif
               oText:Add( "%hdir%\bin\harbour "+cFile+" /a/n/m/w /i..\include;%hdir%\include > clip_prg.log")
            endif
           
            if nPRGFile > 1
               for n := 1 to len(aPRGFile)
               
                  cFile := aPRGFile[n]
                 
                  if !file(cFile+".prg")
                      oText:Close()
                    ?"File "+cFile+".prg not found"
                      ClearFileCompiler()
                      return nil
                  endif
                 
                  if n == 1
                     oText:Add( "%hdir%\bin\harbour "+cFile+" /a/n/m/w /i..\include;%hdir%\include  > clip_prg.log")
                  else  
                     oText:Add( "%hdir%\bin\harbour "+cFile+" /a/n/m/w /i..\include;%hdir%\include >> clip_prg.log")
                  endif  
               next  
            endif
           
            // ----------------------------------
           
            oText:Add( "")
            oText:Add( "")
           
           
            // Microsoft COMPILER
           
            if nPRGFile == 1
               cFile := aPRGFile[1]
               if !file(cFile+".c")
                  oText:Close()
                  ?"File "+cFile+".c not found"
                  ClearFileCompiler()
                  return nil
               endif
               
               oText:Add( "%vcdir%\bin\cl -TP -W3 -c /GA "+cFile+".c >clip_c.log")
            endif
           
            if nPRGFile > 1
               for n := 1 to len(aPRGFile)
                   cFile := aPRGFile[n]
                   
                   if !file(cFile+".c")
                      oText:Close()
                      ?"File "+cFile+".c not found"
                      ClearFileCompiler()
                      return nil
                   endif
               
                   if n == 1
                      oText:Add( "%vcdir%\bin\cl -TP -W3 -c /GA "+cFile+".c >clip_c.log")
                   else
                      oText:Add( "%vcdir%\bin\cl -TP -W3 -c /GA "+cFile+".c >>clip_c.log")
                   endif  
               next
            endif
            // -----------------------------------------
           
           
            oText:Add( "")
            oText:Add( "")
           
            if nRCFile == 1
               oText:Add( "IF EXIST "+cFileRC+".rc %vcdir%\bin\rc -r -d__FLAT__ "+cFileRC+"")
            endif  
           
           
            // Microsoft LINKER
           
            if nPRGFile == 1
               cFile := aPRGFile[1]
               if file(cFile+".obj")
                  oText:Add( "echo "+cFile+".obj > msvc.tmp")
               else
                  oText:Close()
                  ?"File "+cFile+".obj not found"  
                  ClearFileCompiler()
                  return nil
               endif  
            endif
           
            if nPRGFile > 1
               xFile := ""
               for n := 1 to len(aPRGFile)
                   cFile := aPRGFile[n]
                   if file(cFile+".obj")
                      xFile += cFile+".obj "
                   else
                      oText:Close()
                      ?"File "+cFile+".obj not found"  
                      ClearFileCompiler()
                      return nil
                   endif  
               next
               
               if empty(xFile)
                  oText:Close()
                  ?"File OBJs not found"
                  ClearFileCompiler()
                  return nil
               else
                  oText:Add( "echo "+xFile+" > msvc.tmp")
               endif  
               
            endif
            // -----------------------------------
               
            oText:Add( "")
            oText:Add( "echo ..\lib\Fivehmx.lib ..\lib\FiveHC32.lib  >> msvc.tmp")
            oText:Add( "")
            oText:Add( "echo %hdir%\lib\ct.lib  >> msvc.tmp")
            oText:Add( "echo %hdir%\lib\png.lib  >> msvc.tmp")
            oText:Add( "echo %hdir%\lib\libmisc.lib  >> msvc.tmp")
            oText:Add( "echo %hdir%\lib\rtl.lib  >> msvc.tmp")
            oText:Add( "echo %hdir%\lib\vm.lib  >> msvc.tmp")
            oText:Add( "echo %hdir%\lib\gtgui.lib  >> msvc.tmp")
            oText:Add( "echo %hdir%\lib\lang.lib  >> msvc.tmp")
            oText:Add( "echo %hdir%\lib\macro.lib  >> msvc.tmp")
            oText:Add( "echo %hdir%\lib\rdd.lib  >> msvc.tmp")                                                                                                        
            oText:Add( "echo %hdir%\lib\dbfntx.lib  >> msvc.tmp")                                                                                                      
            oText:Add( "echo %hdir%\lib\dbfcdx.lib  >> msvc.tmp")                                                                                                      
            oText:Add( "echo %hdir%\lib\dbffpt.lib  >> msvc.tmp")                                                                                                      
            oText:Add( "echo %hdir%\lib\hbsix.lib  >> msvc.tmp")                                                                                                      
            oText:Add( "echo %hdir%\lib\sixcdx.lib  >> msvc.tmp")                                                                                                      
            oText:Add( "echo %hdir%\lib\debug.lib  >> msvc.tmp")                                                                                                      
            oText:Add( "echo %hdir%\lib\common.lib  >> msvc.tmp")                                                                                                      
            oText:Add( "echo %hdir%\lib\pp.lib  >> msvc.tmp")                                                                                                          
            oText:Add( "echo %hdir%\lib\pcrepos.lib  >> msvc.tmp")                                                                                                    
            oText:Add( "echo %hdir%\lib\png.lib  >> msvc.tmp")                                                                                                        
            oText:Add( "echo %hdir%\lib\zlib.lib  >> msvc.tmp")                                                                                                        
            oText:Add( "")
            oText:Add( "rem Uncomment these two lines to use Advantage RDD")
            oText:Add( "rem echo %hdir%\lib\vc\rddads.lib >> msvc.tmp")
            oText:Add( "rem echo %hdir%\lib\vc\ace32.lib >> msvc.tmp")                                                                                                
            oText:Add( "")
            oText:Add( "echo %vcdir%\lib\kernel32.lib  >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\user32.lib    >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\gdi32.lib     >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\winspool.lib  >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\comctl32.lib  >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\comdlg32.lib  >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\advapi32.lib  >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\shell32.lib   >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\ole32.lib     >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\oleaut32.lib  >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\uuid.lib      >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\odbc32.lib    >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\odbccp32.lib  >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\mpr.lib       >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\msimg32.lib   >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\oledlg.lib    >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\psapi.lib    >> msvc.tmp")  
            oText:Add( "echo %vcdir%\lib\version.lib   >> msvc.tmp")  
            oText:Add( "")
            if nRCFile == 1
               oText:Add( "IF EXIST %"+cFileRC+".res echo "+cFileRC+".res >> msvc.tmp")
            endif  
            oText:Add( "")
            oText:Add( "%vcdir%\bin\link @msvc.tmp /NODEFAULTLIB:LIBC /nologo /subsystem:windows /libpath:d:\mvc2013\lib /force:multiple >link.log")
            oText:Add( "")
            oText:Add( "ECHO * Application successfully built >oke.log")
            oText:Add( "GOTO EXIT")
            oText:Add( "ECHO")
            oText:Add( "")
            oText:Add( ":EXIT")

      oText:Close()
   endif
   
   define dialog oDlgCompile from 1,1 to 40,350 pixel style nOR( WS_CAPTION ) title "Compiling..."
   
   activate dialog oDlgCompile centered nowait
   
   WaitRun( "compile.bat", 0 )
   
   oDlgCompile:End()
   
   if file("oke.log")
       MsgInfo( MemoRead( "oke.log" ) )
   else
      MsgInfo( "There are errors" )    
   endif    
   
   
   

return nil

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


static function ClearFileCompiler()
   deletefile("compile.bat")
   deletefile("msvc.tmp")
   deletefile("oke.log")
   deletefile("clip_c.log")
   deletefile("clip_prg.log")
   deletefile("link.log")
return nil

 


create file prg.tmp
Code: Select all  Expand view

ribbon.prg
ribbon.rc
 


Best Regards
Fafi

Re: xHarbour 1.2.3 (Build 20130117) with MSVC 2013 Express

PostPosted: Thu Aug 07, 2014 4:11 am
by Antonio Linares
Fafi,

More and more FWH users are migrating to Harbour, why do you want to keep using xHarbour ?

Re: xHarbour 1.2.3 (Build 20130117) with MSVC 2013 Express

PostPosted: Thu Aug 07, 2014 10:13 am
by fafi
Antonio Linares wrote:Fafi,

More and more FWH users are migrating to Harbour, why do you want to keep using xHarbour ?


Hello Mr. Antonio..

I got source code from here :
http://sourceforge.net/projects/xharbou ... z/download
Mr. Andijahja also from Indonesia, me too
Just to try it, I tried both xHarbour and Harbour with no problem..


Best Regards
Fafi

Re: xHarbour 1.2.3 (Build 20130117) with MSVC 2013 Express

PostPosted: Thu Aug 07, 2014 10:57 am
by Antonio Linares
Fafi,

Harbour provides a library that includes the whole compiler inside, so you can compile your PRGs in memory and execute them. xHarbour does not provide this powerful feature.

If you download FiveDBU you can test this great feature from "Processes" option. Just open any DBF or ADO table and you can write PRG code and execute it in memory. Once you test that you will have very clear what compiler to use:

Full source code included:
https://bitbucket.org/fivetech/fivewin-contributions/downloads/fivedbu_20140730.zip