See changelog 2001-11-08 22:40 GMT -3

This commit is contained in:
Luiz Rafael Culik
2001-11-09 00:29:23 +00:00
parent bf552680af
commit 0590de0288
3 changed files with 367 additions and 66 deletions

View File

@@ -1,3 +1,8 @@
2001-11-08 22:40 GMT -3 Luiz Rafael Culik<culik@sl.conex.net>
* utils/hbmake/hbmake.prg
utils/hbmake/hbmake.prg
* Fix some small problem with hbmake under linux
2001-11-09 05:20 GMT +7 Andi Jahja <harbour@cbn.net.id>
* utils/hbmake/hbmutils.prg
! add Copyright header

View File

@@ -48,7 +48,7 @@
* If you do not wish that, delete this exception notice.
*
*/
#include 'fileio.ch'
#include "fileio.ch"
#include "common.ch"
#include "radios.ch"
#include "checks.ch"
@@ -59,7 +59,7 @@
#define EOL chr(13)+chr(10)
#define hb_osnewline() chr(13)+chr(10)
#define CRLF hb_osnewline()
#include 'hbclip.ch'
#include "hbclip.ch"
#endif
#xtranslate timetosec(<x>) => ((val(substr(<x>,1,2))*3600)+(val(substr(<x>,4,2))*60)+(val(substr(<x>,7,2))))
DECLARE TestforPrg(cFile as String)
@@ -110,7 +110,7 @@ Local nPos
Local aDef := {}
Local cOs:=OS()
Local allParam
//__traceprgcalls(.t.)
Default p1 To ""
Default p2 To ""
Default p3 To ""
@@ -1901,9 +1901,9 @@ Elseif lGcc
Aadd( aCommands, { ".c.o:", "gcc -I$(HB_INC_INSTALL) $(CFLAG1) $(CFLAG2) -I. -o$* $**" } )
if lextended
Aadd( aCommands, { ".prg.o:", "harbour -n -I$(HB_INC_INSTALL) -I. -go -o$* $**" } )
Aadd( aCommands, { ".prg.o:", "harbour -n $(HARBOURFLAGS) -I$(HB_INC_INSTALL) -I. -go -o$* $**" } )
else
Aadd( aCommands, { ".prg.c:", "harbour -n -I$(HB_INC_INSTALL) -I. -o$* $**" } )
Aadd( aCommands, { ".prg.c:", "harbour -n $(HARBOURFLAGS) -I$(HB_INC_INSTALL) -I. -o$* $**" } )
endif
else
Aadd( aCommands, { ".cpp.o:", "$(BCB)\bin\gcc $(CFLAG1) $(CFLAG2) -o$* $*" } )
@@ -2162,7 +2162,7 @@ Local aTemp as Array
Local nCount as Numeric
Local aCurobjs as Array
Local nObjPos as Numeric
Local cLib
// ? "setting link file"
cRead := Alltrim( readln( @leof ) )
@@ -2182,7 +2182,7 @@ amacro := listasarray2( cRead, '\' )
if lbcc .or. lVcc
cLinkcomm := cRead + " @" + cLinker
else
cLinkcomm := cRead + " " + cLinker + " < "
cLinkcomm := cRead + " < " + cLinker
endif
@@ -2195,7 +2195,7 @@ For nPos := 1 To 7
if (amacro[ nCount ] = "$(PROJECT)") .and. lGcc
Findmacro(amacro[ nCount ], @cRead )
fwrite(nLinkHandle,"CREATE " + "lib"+cRead+CRLF)
cLib:="lib"+cRead
elseif (amacro[ nCount ] =="$(ALLOBJ)")
findmacro( amacro[ nCount ], @cRead )
aCurObjs:=ListasArray2(cRead," ")
@@ -2221,7 +2221,9 @@ fwrite(nLinkHandle, "END " +CRLF)
endif
Fclose( nLinkhandle )
if lLinux
cLinkComm += " || rm -f " +cLib
endif
outstd(cLinkComm)
Return nil

View File

@@ -4,7 +4,7 @@
/*
* Harbour Project source code:
* checks.Prg checks gets for hbmake
* hbmutils utility functions for hbmake
*
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
* www - http://www.harbour-project.org
@@ -50,370 +50,661 @@
*/
#include "common.ch"
#ifndef __HARBOUR__
#include "hbclip.ch"
#include 'hbclip.ch'
#else
DECLARE extenprg( cExt AS STRING, nType AS NUMERIC ) AS STRING
DECLARE exten( cExt as string, nType as numeric ) as string
DECLARE GetSourceFiles( lSubdir as logical ) as ARRAY
DECLARE GetDirs( cPat as USUAL ) as Array
DECLARE GetBccDir() as String
DECLARE GetVccDir() as String
DECLARE GetMakeDir() as String
DECLARE HB_ARGV( n as numeric ) as string
DECLARE filedate( c as String ) as string
DECLARE listasArray2( cString as String, cSep as String ) as Array
DECLARE extenprg( cExt AS STRING, nType AS NUMERIC ) AS STRING
declare exten( cExt as string, nType as numeric ) as string
DECLARE GetSourceFiles( lSubdir as logical ) as ARRAY
DECLARE GetDirs( cPat as USUAL ) as Array
DECLARE GetBccDir() as String
DECLARE GetVccDir() as String
DECLARE GetMakeDir() as String
DECLARE HB_ARGV( n as numeric ) as string
declare filedate( c as String ) as string
declare listasArray2( cString as String, cSep as String ) as Array
#endif
Function GetSourceFiles( lSubdir,lgcc ,cOs)
Local adirs AS ARRAY
Local aRet AS ARRAY := {}
Local lLinux:=at('linux',lower(os()))>0
Local cdir := If( at('Linux',cOs)==0, '\' + Curdir() + '\', '/' + Curdir() + '/' )
Local aStru := { cDir }
Local aData AS ARRAY
Local nCounter as numeric := 0
Local nArrayLen as numeric
Local nDatalen as numeric
Local y as numeric
Local cItem as String
Local cext
Local cpath
Local cdrive
Local nPos
Local xItem
Default lSubdir To .t.
default lGcc to .f.
if (cOs =='OS/2') .or. (cOs=='Win32')
While ++ nCounter <= Len( aStru )
If !Empty( adirs := GetDirs( astru[ nCounter ] ) ) // There are elements!
Aeval( aDirs, { | xItem | Aadd( aStru, xItem +if(lGcc,"/","\")) } )
Endif
Enddo
else
While ++ nCounter <= Len( aStru )
If !Empty( adirs := GetDirsl( astru[ nCounter ] ) ) // There are elements!
Aeval( aDirs, { | xItem | Aadd( aStru, xItem ) } )
Endif
Enddo
endif
While ++ nCounter <= Len( aStru )
If !Empty( adirs := GetDirs( astru[ nCounter ] ) ) // There are elements!
Aeval( aDirs, { | xItem | Aadd( aStru, xItem +if(lGcc,"/","\")) } )
Endif
Enddo
aDirs := {}
Asort( aStru )
nArrayLen := Len( aStru )
For nCounter := 1 To nArrayLen
If Len( aData := Directory( aStru[ nCounter ] + "*.*" ) ) != 0
nDataLen := Len( aData )
For y := 1 To nDataLen
If At( '.PRG', Upper( adata[ y, 1 ] ) ) > 0 .or. At( '.C', Upper( adata[ y, 1 ] ) ) > 0
If lSubdir
Aadd( aRet, Strtran( astru[ nCounter ], cDir, '' ) + Pad( aData[ y, 1 ], 13 ) + ;
Str( aData[ y, 2 ], 8 ) + ' ' + ;
Dtoc( aData[ y, 3 ] ) + ' ' + ;
aData[ y, 4 ] )
Elseif !lsubdir .and. At( If( lGcc, "/", "\" ), Strtran( astru[ nCounter ], cDir, '' ) ) == 0
Aadd( aRet, Pad( aData[ y, 1 ], 13 ) + ;
Str( aData[ y, 2 ], 8 ) + ' ' + ;
Str( aData[ y, 2 ], 8 ) + ' ' + ;
Dtoc( aData[ y, 3 ] ) + ' ' + ;
aData[ y, 4 ] )
Endif
Endif
Next
Endif
Next
For nCounter := 1 To Len( aret )
xItem := Substr( aret[ nCounter ], Rat( If( lGcc, "/", '\' ), aret[ nCounter ] ) + 1 )
nPos := Ascan( astru, { | x | x := Substr( x, Rat( if(lGcc,"/",'\'), x ) + 1 ), Left( x, At( ".", x ) ) == Left( xitem, At( ".", xitem ) ) } )
If nPos > 0
Adel( astru, nPos )
Asize( astru, Len( astru ) - 1 )
Endif
Next
For nCounter := 1 To Len( aStru )
hb_FNAMESPLIT( Left( astru[ nCounter ], At( ' ', astru[ nCounter ] ) - 1 ), @cPath, @cItem, @cExt, @cDrive )
If ( cExt == '.C' ) .or. ( cExt == ".c" )
Aadd( aret, astru[ nCounter ] )
Endif
Next
Return aRet
Function extenprg( cExt, nType )
Local aext AS ARRAY := { "C", "c" }
Local nPos AS NUMERIC
Local cTemp AS String := ""
nPos := Ascan( aext, { | a | a == cExt } )
If nPos > 0
If nTYpe == 1
cTemp := Strtran( cExt, aExt[ nPos ], 'prg' )
Elseif ntype == 2
cTemp := Strtran( cExt, aExt[ nPos ], 'prG' )
Elseif ntype == 3
cTemp := Strtran( cExt, aExt[ nPos ], 'pRg' )
Elseif ntype == 4
cTemp := Strtran( cExt, aExt[ nPos ], 'Prg' )
Elseif ntype == 5
cTemp := Strtran( cExt, aExt[ nPos ], 'PRg' )
Elseif ntype == 6
cTemp := Strtran( cExt, aExt[ nPos ], 'PrG' )
Elseif ntype == 7
cTemp := Strtran( cExt, aExt[ nPos ], 'PRG' )
Endif
Endif
Return ctemp
Static Function GetDirs( cPattern ,lGcc)
Static Function GetDirs( cPattern )
Local aDir := {}
Local lLinux := At( 'linux', Os() ) > 0
Aeval( Directory( cPattern + "*.", "D" ), ;
{ | xItem | If( xItem[ 5 ] = "D" .and. ;
( xItem[ 1 ] != "." .and. xItem[ 1 ] != ".." ), ;
Aadd( aDir, cPattern + xItem[ 1 ] ), "" ) } )
{ | xItem | If( xItem[ 5 ] = "D" .and. if(!llinux , xItem[ 1 ] != "." .and. xItem[ 1 ] != ".." ,), ;
( Aadd( aDir, cPattern + xItem[ 1 ] + If( llinux, "\", '/' ) ), ;
Outstd( "." ) ), "" ) } )
Return ( aDir )
Static Function GetDirsl( cPattern )
Local aDir := {}
Aeval( Directory( cPattern + "*.", "D" ), ;
{ | xItem | If( xItem[ 5 ] = "D" , ;
Aadd( aDir, cPattern + xItem[ 1 ] + "/" ), "" ) } )
Local aDir := {}
qout(cPattern)
Aeval( Directory( cPattern+"*.*", "D" ), ;
{ | xItem | If( xItem[ 5 ] == "D" , ;
Aadd( aDir, cPattern + xItem[ 1 ] ), "" ) } )
Return ( aDir )
Function GetBccDir()
Local cPath := ''
Local cEnv := Gete( "PATH" )
Local aEnv := listasarray2( cEnv, ";" )
Local nPos
For nPos := 1 To Len( aEnv )
If File( aenv[ nPos ] + '\bcc32.exe' ) .or. File( Upper( aenv[ nPos ] ) + '\BCC32.EXE' )
cPath := aenv[ nPos ]
cPath := Left( cPath, Rat( '\', cPath ) - 1 )
Exit
Endif
Next
Return cPath
Return cPath
Function GetVccDir()
Local cPath AS STRING := ''
Local cEnv AS STRING := Gete( "PATH" )
Local aEnv as array of string := listasarray2( cEnv, ";" )
Local nPos as numeric
For nPos := 1 To Len( aEnv )
If File( aenv[ nPos ] + '\cl.exe' ) .or. File( Upper( aenv[ nPos ] ) + '\cl.EXE' )
cPath := aenv[ nPos ]
cPath := Left( cPath, Rat( '\', cPath ) - 1 )
Exit
Endif
Next
Return cPath
Function exten( cExt, nType )
Local aext as array := { 'C', 'c' }
Local nPos as numeric
Local cTemp as string := ""
nPos := Ascan( aext, { | a | a == cExt } )
If nPos > 0
If nTYpe == 1
cTemp := Strtran( cExt, aExt[ nPos ], 'o' )
Elseif ntype == 2
cTemp := Strtran( cExt, aExt[ nPos ], 'obj' )
Endif
Endif
Return ctemp
Function ListAsArray2( cList, cDelimiter )
Local nPos as numeric
Local aList as array := {} // Define an empty array
If cDelimiter = NIL
cDelimiter := ","
Endif
//
Do While ( nPos := At( cDelimiter, cList ) ) != 0
Aadd( aList, Alltrim( Substr( cList, 1, nPos - 1 ) ) ) // Add a new element
cList := Substr( cList, nPos + 1 )
Enddo
Aadd( aList, Alltrim( cList ) ) // Add final element
//
Return aList // Return the array
Function GetMakeDir()
Local cPath := ""
Local cExe := HB_ARGV( 0 )
cPath := Left( cexe, Rat( "\", cexe ) - 1 )
cPath := Left( cPath, Rat( "\", cPath ) - 1 )
Return cPath
Function GetSourceDirMacros(lgcc,cOs)
Local adirs AS ARRAY
Local cdir as String := If( at('Linux',cOs)>0, '/' + Curdir() + '/', '\' + Curdir() + '\' )
Local aStru := { cDir }
Local nCounter as numeric := 0
Local amacros as Array := {}
if (cOs =='OS/2') .or. (cOs=='Win32')
While ++ nCounter <= Len( aStru )
If !Empty( adirs := GetDirs( astru[ nCounter ] ) ) // There are elements!
Aeval( aDirs, { | xItem | Aadd( aStru, xItem+if(lGcc,"/","\") ) } )
Endif
Enddo
else
While ++ nCounter <= Len( aStru )
If !Empty( adirs := GetDirsl( astru[ nCounter ] ) ) // There are elements!
Aeval( aDirs, { | xItem | Aadd( aStru, xItem ) } )
Endif
Enddo
endif
Local adirs AS ARRAY
Local lLinux:=At("linux",lower(os()))>0
Local cdir := If( at('linux',lower(os()))>0, '/' + Curdir() + '/', '\' + Curdir() + '\' )
Local aStru := { cDir }
Local nCounter := 0
Local amacros := {}
While ++ nCounter <= Len( aStru )
If !Empty( adirs := GetDirs( astru[ nCounter ] ) ) // There are elements!
Aeval( aDirs, { | xItem | Aadd( aStru, xItem+if(lGcc,"/","\") ) } )
Endif
Enddo
/* else
While ++ nCounter <= Len( aStru )
If !Empty( adirs := GetDirsl( astru[ nCounter ] ) ) // There are elements!
Aeval( aDirs, { | xItem | Aadd( aStru, xItem+"/" ) } )
Endif
Enddo
endif*/
For nCounter := 1 To Len( aStru )
Aadd( amacros, { "SRC" + Strzero( nCounter, 2, 0 ), Strtran( astru[ nCounter ], cDir, '' ),.f. } )
Next
Return amacros
Function filedate( cFileName )
Local aFiles := Directory( cFileName )
Return If( Len( aFiles ) == 1, aFiles[ 1, 3 ], Ctod( '' ) )
Function filetime( cFileName )
Local aFiles := Directory( cFileName )
Return If( Len( aFiles ) == 1, aFiles[ 1, 4 ], '' )
Function TD2JUL( CTIME, DDATE )
Return DDATE - Ctod( '01/01/1900' ) + ( PRB_INT( TTOS( CTIME ) / 100000,, 5 ) )
Function TTOS( CTIME )
Return ( Val( Substr( CTIME, 7, 2 ) ) ) + ;
( Val( Substr( CTIME, 4, 2 ) ) * 60 ) + ;
( Val( Substr( CTIME, 1, 2 ) ) * 3600 )
Function PRB_INT( SOMENUMBER, length, NUM_DECIMALS )
Local NEGATIVE := ( SOMENUMBER < 0 )
Local SOMESTRING
Local dotat
Default NUM_DECIMALS To 0
Default length To 19
If NEGATIVE
SOMENUMBER := Abs( SOMENUMBER )
Endif
SOMENUMBER += .0000000000000005
SOMESTRING := Alltrim( Str( SOMENUMBER ) )
dotat := At( '.', somestring )
Do Case
Case NUM_DECIMALS == 0
If dotat > 0
somestring := Left( somestring, dotat - 1 )
Endif
Case NUM_DECIMALS > 0
If dotat > 0
somestring := Left( somestring, dotat + num_decimals )
Endif
Endcase
If NEGATIVE
SOMESTRING := '-' + SOMESTRING
Endif
Return Val( SOMESTRING )
Function exte( cExt, nType )
Local aext := { 'prg', 'prG', 'pRg', 'Prg', 'PRg', 'PrG', 'PRG' }
Local nPos
Local cTemp := ""
nPos := Ascan( aext, { | a | a == cExt } )
If nPos > 0
If nTYpe == 1
cTemp := Strtran( cExt, aExt[ nPos ], 'c' )
Elseif ntype == 2
cTemp := Strtran( cExt, aExt[ nPos ], 'obj' )
Elseif ntype == 3
cTemp := Strtran( cExt, aExt[ nPos ], 'o' )
Endif
Endif
Return ctemp
Procedure ATTENTION( CSTRING, NLINENUM, CCOLOR )
Local COLDCOLOR
Default NLINENUM To 24
Default CCOLOR To 'GR+/R'
COLDCOLOR := Setcolor( CCOLOR )
CSTRING := ' ' + Alltrim( CSTRING ) + ' '
Devpos( NLINENUM, c( CSTRING ) )
Devout( CSTRING )
Setcolor( COLDCOLOR )
Return
Function c( CSTRING )
Return Max( ( Maxcol() / 2 ) - Int( Len( CSTRING ) / 2 ), 0 )
Function ReadLN( leof )
Local cBuffer := ""
cBuffer := FT_FREADLN()
cBuffer := Strtran( cBuffer, Chr( 13 ), '' )
cBuffer := Strtran( cBuffer, Chr( 10 ), '' )
FT_FSKIP( 1 )
@@ -422,4 +713,7 @@ Function ReadLN( leof )
Return cBuffer
*+ EOF: HBMUTILS.PRG