See changelog 2001-10-20 20:00 GMT -3
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
2001-10-20 20:00 GMT -3 Luiz Rafael Culik<culik@sl.conex.net>
|
||||
* source/compiler/harbour.c
|
||||
* Changed some function parameters in the _DECL section
|
||||
* utils/hbmake/hbmake.prg
|
||||
% removed unused variables
|
||||
+ New parameter -r: recurse sub directories on editor mode
|
||||
% enhaced -e and -el: the enhaced parameters has an x on the end.
|
||||
using the -ex or -elx tells hbmake to use harbour .obj generation capabilities
|
||||
% many For/Next Loop replaced for an fastern Aeval() function call
|
||||
* Support for generating output files in other dir
|
||||
|
||||
+ utils/hbmake/hbmutils.prg
|
||||
* All utilities function inside hbmake.prg was moved to this module
|
||||
* utils/hbmake/pickfile.prg
|
||||
*added pickafile() function
|
||||
+ doc/hbmake.txt
|
||||
* some info about hbmake. Linux users should read to see how to set harbour.cfg.
|
||||
* makefile.bc
|
||||
makefile.vc
|
||||
hb_slex.vc
|
||||
utils/hbmake/Makefile
|
||||
* Added hbmutils.prg to dependencie List
|
||||
|
||||
2001-10-20 07:30 GMT -3 Luiz Rafael Culik<culik@sl.conex.net>
|
||||
*contrib/hbzlib/zipnew.cpp
|
||||
contrib/hbzlib/zipcomp.cpp
|
||||
|
||||
51
harbour/doc/hbmake.txt
Normal file
51
harbour/doc/hbmake.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
Hbmake Readme
|
||||
|
||||
|
||||
Hbmake is an powerfull make system for Harbour.It include an Editor mode for
|
||||
the creation of the make file.
|
||||
|
||||
Hbmake support the follow Switchs
|
||||
|
||||
-b Use Bcc as the C compiler.This options is default under Win32
|
||||
-g Use Gcc as the C compiler.This options is default under OS/2
|
||||
-gl Use Gcc as the C compiler on Linux
|
||||
-v Use MSVC as the C compiler
|
||||
-D Define an macro. Multiple macros can be used in an single line
|
||||
Ex:
|
||||
-DOB=c.obj;d.obj
|
||||
and also Multiple -D is also supported
|
||||
-p Print all command and defines
|
||||
-f Force all files to be rebuild
|
||||
-e Open the editor mode.
|
||||
-ex Open the editor mode in extended mode
|
||||
-el Open the editor mode for creating libraries.
|
||||
-elx Open the editor mode for creating librariesin extented mode.
|
||||
-i Ignore errors returned by commands
|
||||
-r Recurse directories for source code
|
||||
The hbmake dont support old styles .RMK/.Lnk Files. hbmake create it own when the editor mode is used with include both compile and link sections on the same file.
|
||||
|
||||
Now How to use the editor mode
|
||||
|
||||
go to the directory from with the application source that you to
|
||||
convert.
|
||||
call hbmake <filename>.bc -e
|
||||
this will evoke hbmake editor mode.
|
||||
|
||||
then select your OS,C Compiler
|
||||
If you need an Graphic library such as FWH or C4W, select the appropiate box, if you also use rddads. also check this box.
|
||||
|
||||
Select the harbour compiler options that you also what to use, along
|
||||
with
|
||||
the defaut values
|
||||
Select the files that will be part of your app
|
||||
|
||||
then select the main file
|
||||
|
||||
then the new make file is create.
|
||||
then call hbmake <filename>.bc
|
||||
|
||||
If you have compiler errors use hbmake <filename>.bc -f
|
||||
@@ -817,6 +817,7 @@ $(HBDOC_EXE) : \
|
||||
|
||||
$(HBMAKE_EXE) : \
|
||||
$(HBMAKE_DIR)\hbmake.prg \
|
||||
$(HBMAKE_DIR)\hbmutils.prg \
|
||||
$(HBMAKE_DIR)\radios.prg \
|
||||
$(HBMAKE_DIR)\checks.prg \
|
||||
$(HBMAKE_DIR)\fclass1.prg \
|
||||
|
||||
@@ -681,6 +681,7 @@ HBDOC_EXE_OBJS = \
|
||||
|
||||
HBMAKE_EXE_OBJS = \
|
||||
$(OBJ_DIR)\hbmake.obj \
|
||||
$(OBJ_DIR)\hbmutils.obj \
|
||||
$(OBJ_DIR)\checks.obj \
|
||||
$(OBJ_DIR)\pickarry.obj \
|
||||
$(OBJ_DIR)\pickfile.obj \
|
||||
@@ -2582,6 +2583,7 @@ $(HBMAKE_EXE) : $(HBMAKE_EXE_OBJS)
|
||||
$(ECHO) $(CFLAGS) > make.tmp
|
||||
$(ECHO) -M -e$(HBMAKE_EXE) >> make.tmp
|
||||
$(ECHO) $(OBJ_DIR)\hbmake.obj >> make.tmp
|
||||
$(ECHO) $(OBJ_DIR)\hbmutils.obj >> make.tmp
|
||||
$(ECHO) $(OBJ_DIR)\radios.obj >> make.tmp
|
||||
$(ECHO) $(OBJ_DIR)\checks.obj >> make.tmp
|
||||
$(ECHO) $(OBJ_DIR)\fclass1.obj >> make.tmp
|
||||
@@ -2600,16 +2602,22 @@ $(HBMAKE_EXE) : $(HBMAKE_EXE_OBJS)
|
||||
$(ECHO) $(MACRO_LIB) >> make.tmp
|
||||
$(ECHO) $(DBFNTX_LIB) >> make.tmp
|
||||
$(ECHO) $(DBFCDX_LIB) >> make.tmp
|
||||
|
||||
$(ECHO) $(DEBUG_LIB) >> make.tmp
|
||||
$(CC) @make.tmp
|
||||
$(DEL) make.tmp
|
||||
|
||||
$(OBJ_DIR)\hbmake.c : $(HBMAKE_DIR)\hbmake.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -b $** -o$@
|
||||
|
||||
$(OBJ_DIR)\hbmake.obj : $(OBJ_DIR)\hbmake.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\hbmutils.c : $(HBMAKE_DIR)\hbmutils.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
|
||||
|
||||
$(OBJ_DIR)\hbmutils.obj : $(OBJ_DIR)\hbmutils.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\radios.c : $(HBMAKE_DIR)\radios.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
|
||||
|
||||
|
||||
@@ -840,6 +840,7 @@ $(HBDOC_EXE) : \
|
||||
|
||||
$(HBMAKE_EXE) : \
|
||||
$(HBMAKE_DIR)\hbmake.prg \
|
||||
$(HBMAKE_DIR)\hbmutils.prg \
|
||||
$(HBMAKE_DIR)\radios.prg \
|
||||
$(HBMAKE_DIR)\checks.prg \
|
||||
$(HBMAKE_DIR)\fclass1.prg \
|
||||
|
||||
@@ -935,11 +935,11 @@ void hb_compDeclaredInit( void )
|
||||
---------- --- ---------- ------------------------------ --------- ------------- ------ */
|
||||
_DECL s_001 = { "AADD" , ' ', 2 , (BYTE*)"A " , NULL , NULL , NULL };
|
||||
_DECL s_002 = { "ABS" , 'N', 1 , (BYTE*)"N" , NULL , NULL , &s_001 };
|
||||
_DECL s_003 = { "ACHOICE" , 'N', 9 , (BYTE*)"NNNNc\x7a\x9d\xa8\xa8", NULL , NULL , &s_002 };
|
||||
_DECL s_003 = { "ACHOICE" , 'N', 9 , (BYTE*)"NNNNA\x7a\x9d\xa8\xa8", NULL , NULL , &s_002 };
|
||||
_DECL s_004 = { "ACLONE" , 'A', 1 , (BYTE*)"A" , NULL , NULL , &s_003};
|
||||
_DECL s_005 = { "ACOPY" , 'A', 5 , (BYTE*)"AA\xa8\xa8\xa8" , NULL , NULL , &s_004};
|
||||
_DECL s_006 = { "ADEL" , 'A', 2 , (BYTE*)"AN" , NULL , NULL , &s_005};
|
||||
_DECL s_007 = { "ADIR" , 'N', 6 , (BYTE*)"\x9d""\x9b\x9b\x9b\x9b\x9b", NULL , NULL , &s_006};
|
||||
_DECL s_007 = { "ADIR" , 'N', 6 , (BYTE*)"\x9d\x9b\x9b\x9b\x9b\x9b", NULL , NULL , &s_006};
|
||||
_DECL s_008 = { "AEVAL" , 'A', 4 , (BYTE*)"AB\xa8\xa8" , NULL , NULL , &s_007};
|
||||
_DECL s_009 = { "AFIELDS" , 'N', 4 , (BYTE*)"A\x9b\x9b\x9b", NULL , NULL , &s_008};
|
||||
_DECL s_010 = { "AFILL" , 'A', 4 , (BYTE*)"A \xa8\xa8" , NULL , NULL , &s_009};
|
||||
@@ -950,7 +950,7 @@ void hb_compDeclaredInit( void )
|
||||
_DECL s_015 = { "AMPM" , 'C', 1 , (BYTE*)"C" , NULL , NULL , &s_014};
|
||||
_DECL s_016 = { "ARRAY" , 'A', 3 , (BYTE*)"N\xa8\xa8" , NULL , NULL , &s_015};
|
||||
_DECL s_017 = { "ASC" , 'N', 1 , (BYTE*)"C" , NULL , NULL , &s_016};
|
||||
_DECL s_018 = { "ASCAN" , 'N', 4 , (BYTE*)"A \xa8\xa8" , NULL , NULL , &s_017};
|
||||
_DECL s_018 = { "ASCAN" , 'N', 4 , (BYTE*)"A\xa7\xa8\xa8" , NULL , NULL , &s_017};
|
||||
_DECL s_019 = { "ASIZE" , 'A', 2 , (BYTE*)"AN" , NULL , NULL , &s_018};
|
||||
_DECL s_020 = { "ASORT" , 'A', 4 , (BYTE*)"A\xa8\xa8\x9c" , NULL , NULL , &s_019};
|
||||
_DECL s_021 = { "AT" , 'N', 2 , (BYTE*)"CC" , NULL , NULL , &s_020};
|
||||
@@ -1009,7 +1009,7 @@ void hb_compDeclaredInit( void )
|
||||
_DECL s_074 = { "DBUSEAREA" , '-', 6 , (BYTE*)"\xa6\x9d""C\x9d\xa6\xa6", NULL , NULL , &s_073};
|
||||
_DECL s_075 = { "DELETED" , 'L', 0 , (BYTE*)NULL , NULL , NULL , &s_074};
|
||||
_DECL s_076 = { "DESCEND" , ' ', 1 , (BYTE*)" " , NULL , NULL , &s_075};
|
||||
_DECL s_077 = { "DEVOUT" , '-', 2 , (BYTE*)" C" , NULL , NULL , &s_076};
|
||||
_DECL s_077 = { "DEVOUT" , '-', 2 , (BYTE*)" \x9d" , NULL , NULL , &s_076};
|
||||
_DECL s_078 = { "DEVOUTPICT" , '-', 3 , (BYTE*)" C\x9d" , NULL , NULL , &s_077};
|
||||
_DECL s_079 = { "DEVPOS" , '-', 2 , (BYTE*)"NN" , NULL , NULL , &s_078};
|
||||
_DECL s_080 = { "DIRECTORY" , 'A', 3 , (BYTE*)"\x9d\x9d\xa6" , NULL , NULL , &s_079};
|
||||
@@ -1031,7 +1031,7 @@ void hb_compDeclaredInit( void )
|
||||
_DECL s_096 = { "EXP" , 'N', 1 , (BYTE*)"N" , NULL , NULL , &s_095};
|
||||
_DECL s_097 = { "FCLOSE" , 'L', 1 , (BYTE*)"N" , NULL , NULL , &s_096};
|
||||
_DECL s_098 = { "FCOUNT" , 'N', 0 , (BYTE*)NULL , NULL , NULL , &s_097};
|
||||
_DECL s_099 = { "FCREATE" , 'N', 2 , (BYTE*)"CN" , NULL , NULL , &s_098};
|
||||
_DECL s_099 = { "FCREATE" , 'N', 2 , (BYTE*)"C\xa8" , NULL , NULL , &s_098};
|
||||
_DECL s_100 = { "FERASE" , 'N', 1 , (BYTE*)"C" , NULL , NULL , &s_099};
|
||||
_DECL s_101 = { "FERROR" , 'N', 0 , (BYTE*)NULL , NULL , NULL , &s_100};
|
||||
_DECL s_102 = { "FIELD" , 'C', 1 , (BYTE*)"N" , NULL , NULL , &s_101};
|
||||
@@ -1125,8 +1125,8 @@ void hb_compDeclaredInit( void )
|
||||
_DECL s_190 = { "ORDNUMBER" , 'N', 2 , (BYTE*)"C\x9d", NULL , NULL , &s_189};
|
||||
_DECL s_191 = { "ORDSETFOCUS" , 'C', 2 , (BYTE*)"\x7a\x9d" , NULL , NULL , &s_190};
|
||||
_DECL s_192 = { "OS" , 'C', 0 , (BYTE*)NULL , NULL , NULL , &s_191};
|
||||
_DECL s_193 = { "OUTERR" , '-', 1 , (BYTE*)" " , NULL , NULL , &s_192};
|
||||
_DECL s_194 = { "OUTSTD" , '-', 1 , (BYTE*)" " , NULL , NULL , &s_193};
|
||||
_DECL s_193 = { "OUTERR" , '-', 1 , (BYTE*)"\x7a" , NULL , NULL , &s_192};
|
||||
_DECL s_194 = { "OUTSTD" , '-', 1 , (BYTE*)"\x7a" , NULL , NULL , &s_193};
|
||||
_DECL s_195 = { "PADC" , 'C', 3 , (BYTE*)" N\x9d" , NULL , NULL , &s_194};
|
||||
_DECL s_196 = { "PADL" , 'C', 3 , (BYTE*)" N\x9d" , NULL , NULL , &s_195};
|
||||
_DECL s_197 = { "PADR" , 'C', 3 , (BYTE*)" N\x9d" , NULL , NULL , &s_196};
|
||||
@@ -1136,8 +1136,8 @@ void hb_compDeclaredInit( void )
|
||||
_DECL s_201 = { "PROCLINE", 'N', 1 , (BYTE*)"\xa8" , NULL , NULL , &s_200};
|
||||
_DECL s_202 = { "PROCNAME", 'N', 1 , (BYTE*)"\xa8" , NULL , NULL , &s_201};
|
||||
_DECL s_203 = { "PROW" , 'N', 0 , (BYTE*)NULL , NULL , NULL , &s_202};
|
||||
_DECL s_204 = { "QOUT" , '-', 2 , (BYTE*)" " , NULL , NULL , &s_203};
|
||||
_DECL s_205 = { "QQOUT" , '-', 2 , (BYTE*)" " , NULL , NULL , &s_204};
|
||||
_DECL s_204 = { "QOUT" , '-', 2 , (BYTE*)"\x7a\x7a" , NULL , NULL , &s_203};
|
||||
_DECL s_205 = { "QQOUT" , '-', 2 , (BYTE*)"\x7a\x7a" , NULL , NULL , &s_204};
|
||||
_DECL s_206 = { "RAT" , 'N', 2 , (BYTE*)"CC" , NULL , NULL , &s_205};
|
||||
_DECL s_207 = { "RDDLIST" , 'A', 1 , (BYTE*)"\xa8" , NULL , NULL , &s_206};
|
||||
_DECL s_208 = { "RDDNAME" , 'C', 0 , (BYTE*)NULL , NULL , NULL , &s_207};
|
||||
|
||||
@@ -10,6 +10,7 @@ ROOT = ../../
|
||||
|
||||
PRG_SOURCES=\
|
||||
hbmake.prg \
|
||||
hbmutils.prg
|
||||
fclass1.prg \
|
||||
ffile1.prg \
|
||||
ft_funcs.prg \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
326
harbour/utils/hbmake/hbmutils.prg
Normal file
326
harbour/utils/hbmake/hbmutils.prg
Normal file
@@ -0,0 +1,326 @@
|
||||
#include "common.ch"
|
||||
#ifndef __HARBOUR__
|
||||
#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
|
||||
#endif
|
||||
Function GetSourceFiles( lSubdir )
|
||||
|
||||
Local adirs AS ARRAY
|
||||
Local aRet AS ARRAY := {}
|
||||
Local lLinux := At( 'linux', Os() ) > 0
|
||||
Local cdir as String := If( !llinux, '\' + 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.
|
||||
|
||||
While ++ nCounter <= Len( aStru )
|
||||
If !Empty( adirs := GetDirs( astru[ nCounter ] ) ) // There are elements!
|
||||
Aeval( aDirs, { | xItem | Aadd( aStru, xItem ) } )
|
||||
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( lLinux, "/", "\" ), Strtran( astru[ nCounter ], cDir, '' ) ) == 0
|
||||
Aadd( aRet, Pad( aData[ y, 1 ], 13 ) + ;
|
||||
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( llinux, "/", '\' ), aret[ nCounter ] ) + 1 )
|
||||
|
||||
nPos := Ascan( astru, { | x | x := Substr( x, Rat( if(llinux,"/",'\'), 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 )
|
||||
|
||||
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 ] + If( llinux, "/", '\' ) ), ;
|
||||
Outstd( "." ) ), "" ) } )
|
||||
|
||||
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
|
||||
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()
|
||||
|
||||
Local adirs AS ARRAY
|
||||
Local lLinux := At( 'linux', Os() ) > 0
|
||||
Local cdir as String := If( llinux, '/' + Curdir() + '/', '\' + Curdir() + '\' )
|
||||
Local aStru := { cDir }
|
||||
|
||||
Local nCounter as numeric := 0
|
||||
Local amacros as Array := {}
|
||||
While ++ nCounter <= Len( aStru )
|
||||
If !Empty( adirs := GetDirs( astru[ nCounter ] ) ) // There are elements!
|
||||
Aeval( aDirs, { | xItem | Aadd( aStru, xItem ) } )
|
||||
Endif
|
||||
Enddo
|
||||
For nCounter := 1 To Len( aStru )
|
||||
Aadd( amacros, { "SRC" + Strzero( nCounter, 2, 0 ), Strtran( astru[ nCounter ], cDir, '' ) } )
|
||||
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 )
|
||||
leof := ft_FEOF()
|
||||
Return cBuffer
|
||||
|
||||
*+ EOF: HBMUTILS.PRG
|
||||
@@ -72,6 +72,9 @@
|
||||
|
||||
#include "common.ch"
|
||||
#include "box.ch"
|
||||
#ifndef __HARBOUR__
|
||||
#include 'hbclip.ch'
|
||||
#endif
|
||||
#include "directry.ch"
|
||||
|
||||
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
@@ -86,8 +89,8 @@
|
||||
function pickfile( cFileSpec )
|
||||
|
||||
local cOldString := savescreen( 8, 19, 16, 61 )
|
||||
local aFiles := directory( cFileSpec )
|
||||
local aPickList := {}
|
||||
local aFiles as array := directory( cFileSpec )
|
||||
local aPickList := {}
|
||||
local cRetVal := ''
|
||||
local sel
|
||||
|
||||
@@ -117,4 +120,31 @@ restscreen( 8, 19, 16, 61, cOldString )
|
||||
|
||||
return cRetVal
|
||||
|
||||
function pickafile( afiles )
|
||||
|
||||
local cOldString := savescreen( 8, 19, 16, 61 )
|
||||
local aPickList := {}
|
||||
local cRetVal := ''
|
||||
local sel
|
||||
|
||||
/*default cFileSpec to '*.*'*/
|
||||
|
||||
dispbox( 8, 19, 16, 61, B_SINGLE + " ", "+W/R" )
|
||||
|
||||
if len( aFiles ) > 0
|
||||
|
||||
/* aeval( aFiles, { | xx | aadd( aPickList, ;
|
||||
xx)} )*/
|
||||
|
||||
sel := achoice( 9, 20, 15, 60, aFiles )
|
||||
|
||||
cRetVal := iif( lastkey() == 27, '', substr(aFiles[ sel ],1,at(' ',afiles[sel])-1) )
|
||||
|
||||
endif
|
||||
|
||||
restscreen( 8, 19, 16, 61, cOldString )
|
||||
|
||||
return cRetVal
|
||||
|
||||
|
||||
*+ EOF: PICKFILE.PRG
|
||||
|
||||
Reference in New Issue
Block a user