#include "Directry.ch"
#define NTRIM( nNumber ) LTrim( Str( nNumber ) )
#define LF Chr( 10 )
FUNCTION MAIN()
LOCAL cTxt, aDir
LOCAL i
cTxt = MEMOREAD( "contrib\hbcurl\hbcurl.hbp" )
cTxt = STRTRAN( cTxt, "libcurl-4.dll", "libcurl-x64.dll" )
MEMOWRIT( "contrib\hbcurl\hbcurl.hbp", cTxt, .F. )
cTxt = MEMOREAD( "config\win\bcc.mk" )
cTxt = STRTRAN( cTxt, " -CP437", "" )
cTxt = STRTRAN( cTxt, "-w-aus -w-ccc -w-csu -w-ovf -w-par -w-rch -w-spa", "" )
cTxt = STRTRAN( cTxt, " -OS -Ov -Oc", "" )
cTxt = STRTRAN( cTxt, " -w-sig", "" )
cTxt = STRTRAN( cTxt, "c0x64.obj", "c0x64.o" )
MEMOWRIT( "config\win\bcc.mk", cTxt, .F. )
cTxt = MEMOREAD( "src\compiler\hbgenerr.c" )
cTxt = STRTRAN( cTxt, "2Codeblock parameter", "4Codeblock parameter" )
MEMOWRIT( "src\compiler\hbgenerr.c", cTxt, .F. )
aDir = DIRECTORY( "src\codepage\*.*" )
FOR i = 1 TO LEN( aDir )
cTxt = MEMOREAD( "src\codepage\" + aDir[ i, F_NAME ] )
cTxt = TOOCTAL( cTxt )
IF cTxt != NIL
MEMOWRIT( "src\codepage\" + aDir[ i, F_NAME ], cTxt, .F. )
ENDIF
NEXT
aDir = DIRECTORY( "src\lang\*.*" )
FOR i = 1 TO LEN( aDir )
cTxt = MEMOREAD( "src\lang\" + aDir[ i, F_NAME ] )
cTxt = TOOCTAL( cTxt )
IF cTxt != NIL
MEMOWRIT( "src\lang\" + aDir[ i, F_NAME ], cTxt, .F. )
ENDIF
NEXT
cTxt = MEMOREAD( "utils\hbmk2\hbmk2.prg" )
cTxt = STRTRAN( cTxt, " -CP437", "" )
cTxt = STRTRAN( cTxt, "-w-sig -w-aus -w-ccc -w-csu -w-ovf -w-par -w-rch -w-spa -w-sus -w-pia", "" )
cTxt = STRTRAN( cTxt, ["-n" + ], 'IF( hbmk[ _HBMK_cCOMP ] == "bcc64", "-output-dir", "-n" ) + ' )
cTxt = STRTRAN( cTxt, [ -OS -Ov -Oc"], ["] )
cTxt = STRTRAN( cTxt, " -w-sig", "" )
cTxt = STRTRAN( cTxt, "c0x64.obj", "c0x64.o" )
cTxt = STRTRAN( cTxt, "cw64mt.lib", "cw64mt.a" )
cTxt = STRTRAN( cTxt, "import64.lib", "import64.a" )
cTxt = STRTRAN( cTxt, [ cLibPathPrefix := ""], 'IF hbmk[ _HBMK_cCOMP ] == "bcc64"' + LF + [bBlk_ImpLib := {| cSourceDLL, cTargetLib, cFlags | win_implib_command_bcc( hbmk, "mkexp.exe {FI} {OL} {ID}", cSourceDLL, cTargetLib, cFlags ) }] + LF + "ENDIF" + LF + [ cLibPathPrefix := ""] )
MEMOWRIT( "utils\hbmk2\hbmk2.prg", cTxt, .F. )
RETURN NIL
STATIC FUNCTION TOOCTAL( cTxt )
LOCAL cRes := ""
LOCAL nVal, cVal
LOCAL lUtf := .F.
LOCAL i
FOR i = 1 TO LEN( cTxt )
IF ASC( SUBSTR( cTxt, i, 1 ) ) <= 127
cRes += SUBSTR( cTxt, i, 1 )
ELSE
nVal = ASC( SUBSTR( cTxt, i, 1 ) )
cVal = ""
WHILE nVal / 8 > 0
cVal = NTRIM( INT( nVal % 8 ) ) + cVal
nVal = INT( nVal / 8 )
ENDDO
cRes += "\" + cVal
lUtf = .T.
ENDIF
NEXT
RETURN IF( lUtf, cRes, NIL )