diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 299c26541a..599be878f2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,65 @@ The license applies to all entries newer than 2009-04-28. */ +2012-07-20 21:01 UTC+0200 Viktor Szakats (vszakats syenar.net) + * contrib/hbct/tests/charhist.prg + * contrib/hbct/tests/csetarge.prg + * contrib/hbgd/tests/gdtestcl.prg + * examples/hbapollo/array.prg + * examples/httpsrv/uhttpd.prg + * formatting + + * contrib/hbmisc/tests/rtfclass.prg + ! fixes + + * contrib/hbmisc/tests/rtfclass.prg + * contrib/hbgd/tests/gdtestcl.prg + ! fixed to not use OS() with string + comparisons to detect host OS + + * contrib/gtwvg/wvgdlg.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/ideconsole.prg + * contrib/hbide/idemain.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/idetags.prg + * contrib/hbxbp/tests/xbpqtc.prg + * examples/gfspell/spell.prg + * examples/gtwvw/tests/cbtest6.prg + * examples/gtwvw/tests/ebtest7.prg + * examples/gtwvw/tests/prog0.prg + * examples/gtwvw/tests/prog1.prg + * examples/gtwvw/tests/prog2.prg + * examples/gtwvw/tests/wvwtest9.prg + * examples/hbvpdf/hbvpdf.prg + * examples/hbxlsxml/xlsxml_y.prg + * examples/hbxlsxml/xlsxml.prg + * tests/codebloc.prg + * tests/langmsg.prg + * tests/memvar.prg + * tests/statics.prg + * tests/testwarn.prg + * tests/tstmacro.prg + % removed superfluous parantheses from RETURN statements + + * examples/hbapollo/tests/test65.prg + * examples/hbapollo/tests/test66.prg + * examples/hbapollo/tests/test77.prg + ! fixed looking for Windows in fixed location + + * examples/hbapollo/tests/test25.prg + * examples/hbapollo/tests/test34.prg + * examples/hbapollo/tests/test35.prg + * examples/hbapollo/tests/test36.prg + * examples/hbapollo/tests/test37.prg + * examples/hbapollo/tests/test38.prg + * examples/hbapollo/tests/test49.prg + * examples/hbapollo/tests/test53.prg + * examples/hbapollo/tests/test56.prg + * examples/hbapollo/tests/test57.prg + * examples/hbapollo/tests/test58.prg + ! removed most hard-wired windows locations + 2012-07-20 14:02 UTC+0200 Viktor Szakats (harbour syenar.net) * include/clipdefs.h * include/extend.api diff --git a/harbour/contrib/gtwvg/wvgdlg.prg b/harbour/contrib/gtwvg/wvgdlg.prg index 3d73e9969a..b764a25ee1 100644 --- a/harbour/contrib/gtwvg/wvgdlg.prg +++ b/harbour/contrib/gtwvg/wvgdlg.prg @@ -212,13 +212,13 @@ METHOD WvgDialog:setFrameState( nState ) DO CASE CASE nState == WVGDLG_FRAMESTAT_MINIMIZED - RETURN ( ::sendMessage( WM_SYSCOMMAND, SC_MINIMIZE, 0 ) != 0 ) + RETURN ::sendMessage( WM_SYSCOMMAND, SC_MINIMIZE, 0 ) != 0 CASE nState == WVGDLG_FRAMESTAT_MAXIMIZED - RETURN ( ::sendMessage( WM_SYSCOMMAND, SC_MAXIMIZE, 0 ) != 0 ) + RETURN ::sendMessage( WM_SYSCOMMAND, SC_MAXIMIZE, 0 ) != 0 CASE nState == WVGDLG_FRAMESTAT_NORMALIZED - RETURN ( ::sendMessage( WM_SYSCOMMAND, SC_RESTORE, 0 ) != 0 ) + RETURN ::sendMessage( WM_SYSCOMMAND, SC_RESTORE, 0 ) != 0 ENDCASE diff --git a/harbour/contrib/hbct/tests/charhist.prg b/harbour/contrib/hbct/tests/charhist.prg index b239b1d6f7..79c9ac6bc9 100644 --- a/harbour/contrib/hbct/tests/charhist.prg +++ b/harbour/contrib/hbct/tests/charhist.prg @@ -65,9 +65,9 @@ PROCEDURE Main() // simple tests QOut( "Simple tests:" ) - QOut( [ charhist("Hello World !")] + "[109] == 3 ? --> ", charhist( "Hello World !" )[109] ) - QOut( [ aeval(charhist("Hello World !"),{|x|nTotal+=x})] ) - AEval( charhist( "Hello World !" ), { |x|nTotal += x } ) + QOut( [ charhist("Hello World !")] + "[109] == 3 ? --> ", charhist( "Hello World !" )[ 109 ] ) + QOut( [ aeval(charhist("Hello World !"), {| x | nTotal += x } ) ] ) + AEval( charhist( "Hello World !" ), {| x | nTotal += x } ) QOut( [ ==> nTotal == len("Hello World !") ? --> ], nTotal == Len( "Hello World !" ) ) QOut( "End test of CHARHIST()" ) diff --git a/harbour/contrib/hbct/tests/csetarge.prg b/harbour/contrib/hbct/tests/csetarge.prg index 202749e78e..87e3f76095 100644 --- a/harbour/contrib/hbct/tests/csetarge.prg +++ b/harbour/contrib/hbct/tests/csetarge.prg @@ -67,7 +67,7 @@ PROCEDURE main QOut( "" ) QOut( "Local error handler: " ) - olderr := ErrorBlock( { | oerr | myerrhandler( oerr ) } ) + olderr := ErrorBlock( {| oerr | myerrhandler( oerr ) } ) // standard behaviour on argument error QOut( "" ) @@ -209,7 +209,7 @@ FUNCTION myerrhandler( oerr ) QOut( " err:operation....:", oerr:operation ) QOut( " len(err:args)....:", Len( oerr:args ) ) FOR ni := 1 TO Len( oerr:args ) - QOut( " err:args[" + hb_ntos( ni ) + "]..:", oerr:args[ni] ) + QOut( " err:args[" + hb_ntos( ni ) + "]..:", oerr:args[ ni ] ) NEXT QOut( " err:genCode......:", oerr:genCode ) QOut( " err:subCode......:", oerr:subCode ) @@ -238,7 +238,7 @@ FUNCTION myerrhandler( oerr ) QOut( " 6 is Block, 7 is Array, 8 is Object" ) QOut( " 9 is unknown" ) nDigit := Int( oerr:subCode % 10 ) - QOut( " Here it's a " + AllTrim( Str(nDigit ) ) + ", so I return a " ) + QOut( " Here it's a " + AllTrim( Str( nDigit ) ) + ", so I return a " ) DO CASE CASE nDigit == 0 QQOut( "NIL." ) @@ -266,7 +266,7 @@ FUNCTION myerrhandler( oerr ) CASE nDigit == 6 QQOut( "Block." ) - Input := { ||NIL } + Input := {|| NIL } CASE nDigit == 7 QQOut( "Array." ) diff --git a/harbour/contrib/hbgd/tests/gdtestcl.prg b/harbour/contrib/hbgd/tests/gdtestcl.prg index bd9cf2f684..c8d3321309 100644 --- a/harbour/contrib/hbgd/tests/gdtestcl.prg +++ b/harbour/contrib/hbgd/tests/gdtestcl.prg @@ -180,9 +180,9 @@ PROCEDURE Main() //oI4:SetColor( black ) //oI4:Say( 100, 10, "Valentina" ) - IF Left( OS(), Len( "Linux" ) ) == "Linux" + #if defined( __PLATFORM__UNIX ) oI4:SayFreeType( oI4:CenterWidth(), oI4:CenterHeight(), "GD power", "arib____", 40, 45 ) - ELSE + #else nSecs := Seconds() ? "start write" FOR n := 0 TO 350 STEP 10 @@ -192,7 +192,7 @@ PROCEDURE Main() oI4:SetTransparent( blue ) oI4:SayFreeType( oI4:CenterWidth() - 4, oI4:CenterHeight() + 4, "GD", "verdana", 70, n, gray ) oI4:SayFreeType( oI4:CenterWidth(), oI4:CenterHeight(), "GD", "verdana", 70, n, blue ) - ENDIF + #endif oI4:SaveJpeg( IMAGES_OUT + "writing.jpg" ) diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index 363f0282ae..59cb27bd82 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -686,7 +686,7 @@ STATIC FUNCTION mnuNormalizeItem( cCaption ) cKey := '' ENDIF - RETURN ( cIco + cCaption + cKey ) + RETURN cIco + cCaption + cKey /*----------------------------------------------------------------------*/ /* diff --git a/harbour/contrib/hbide/ideconsole.prg b/harbour/contrib/hbide/ideconsole.prg index 073e54c327..571f1b0d89 100644 --- a/harbour/contrib/hbide/ideconsole.prg +++ b/harbour/contrib/hbide/ideconsole.prg @@ -3167,7 +3167,7 @@ STATIC FUNCTION VouchGetColor( cType, cColor ) /*----------------------------------------------------------------------*/ FUNCTION VouchInRange( v, r1, r2 ) - RETURN ( v >= r1 .AND. v <= r2 ) + RETURN v >= r1 .AND. v <= r2 /*----------------------------------------------------------------------*/ @@ -3184,7 +3184,7 @@ FUNCTION pad_max( a_,lNum,max ) /*----------------------------------------------------------------------*/ FUNCTION VouchInArray( v,a_ ) - RETURN( ascan( a_,{|e| e = v } ) > 0 ) + RETURN ascan( a_,{|e| e = v } ) > 0 //----------------------------------------------------------------------// @@ -3553,7 +3553,7 @@ FUNCTION xtos( x ) //----------------------------------------------------------------------// FUNCTION VouchRgb( nR, nG, nB ) - RETURN ( nR +( nG * 256 ) +( nB * 256 * 256 ) ) + RETURN nR +( nG * 256 ) +( nB * 256 * 256 ) //---------------------------------------------------------------------// @@ -4474,7 +4474,7 @@ FUNCTION VouchAChoice( nTop, nLft, nBtm, nRgt, acItems, xSelect, cUserFunc, nPos SetCursor( crs ) - RETURN ( nChoice ) + RETURN nChoice /*----------------------------------------------------------------------*/ @@ -5171,7 +5171,7 @@ STATIC FUNCTION Before( cDelim, cValue ) cRetVal := left( cValue, at( cDelim, cValue ) - 1 ) ENDIF - RETURN ( cRetVal ) + RETURN cRetVal //----------------------------------------------------------------------// @@ -5182,7 +5182,7 @@ STATIC FUNCTION After( cDelim, cValue ) cRetVal := substr( cValue, at( cDelim, cValue ) + 1 ) ENDIF - RETURN ( cRetVal ) + RETURN cRetVal /*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idemain.prg b/harbour/contrib/hbide/idemain.prg index cf8fb5a07f..5d91d6f3ce 100644 --- a/harbour/contrib/hbide/idemain.prg +++ b/harbour/contrib/hbide/idemain.prg @@ -1582,7 +1582,7 @@ METHOD HbIde:CreateTags() ENDIF NEXT - RETURN ( NIL ) + RETURN NIL //----------------------------------------------------------------------// /* diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 885a6fc6ad..1058b8cc86 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -259,7 +259,7 @@ FUNCTION hbide_getYesNo( cMsg, cInfo, cTitle, qParent ) oMB:setParent( QWidget() ) - RETURN ( nRet == QMessageBox_Yes ) + RETURN nRet == QMessageBox_Yes /*----------------------------------------------------------------------*/ @@ -575,7 +575,7 @@ FUNCTION hbide_isValidText( cSourceFile ) hb_fNameSplit( cSourceFile, , , @cExt ) - RETURN ( lower( cExt ) $ hbide_setIde():oINI:cTextFileExtensions ) + RETURN lower( cExt ) $ hbide_setIde():oINI:cTextFileExtensions /*----------------------------------------------------------------------*/ @@ -584,7 +584,7 @@ FUNCTION hbide_isValidSource( cSourceFile ) hb_fNameSplit( cSourceFile, , , @cExt ) - RETURN ( lower( cExt ) $ ".c,.cpp,.prg,.res,.rc,.hb" ) + RETURN lower( cExt ) $ ".c,.cpp,.prg,.res,.rc,.hb" /*----------------------------------------------------------------------*/ @@ -593,7 +593,7 @@ FUNCTION hbide_isSourcePPO( cSourceFile ) hb_fNameSplit( cSourceFile, , , @cExt ) - RETURN ( lower( cExt ) == ".ppo" ) + RETURN lower( cExt ) == ".ppo" /*----------------------------------------------------------------------*/ @@ -602,7 +602,7 @@ FUNCTION hbide_isSourcePRG( cSourceFile ) hb_fNameSplit( cSourceFile, , , @cExt ) - RETURN ( lower( cExt ) == ".prg" ) + RETURN lower( cExt ) == ".prg" /*----------------------------------------------------------------------*/ @@ -852,7 +852,7 @@ FUNCTION hbide_parseKeyValPair( s, cKey, cVal ) lYes := ( !empty( cKey ) .and. !empty( cVal ) ) ENDIF - RETURN ( lYes ) + RETURN lYes /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idetags.prg b/harbour/contrib/hbide/idetags.prg index 0cb0f1ad87..9fc4dbfc63 100644 --- a/harbour/contrib/hbide/idetags.prg +++ b/harbour/contrib/hbide/idetags.prg @@ -323,7 +323,7 @@ FUNCTION Summarize( aText, cComments, aSumData, nFileType ) ENDIF NEXT - RETURN( aSummary ) + RETURN aSummary /*----------------------------------------------------------------------*/ /* @@ -419,7 +419,7 @@ FUNCTION CheckComments( aText ) NEXT - RETURN ( cComments ) + RETURN cComments /*----------------------------------------------------------------------*/ @@ -443,6 +443,6 @@ STATIC FUNCTION IsInString( cText, nPos, nStart, cQuote ) ENDIF NEXT - RETURN ( lInString ) + RETURN lInString /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbmisc/tests/rtfclass.prg b/harbour/contrib/hbmisc/tests/rtfclass.prg index 62efb1eca8..7823e13581 100644 --- a/harbour/contrib/hbmisc/tests/rtfclass.prg +++ b/harbour/contrib/hbmisc/tests/rtfclass.prg @@ -38,10 +38,10 @@ PROCEDURE Main() ortf:close() // execute file association ( windows only ) - IF Lower( OS() ) == "windows" + #if defined( __PLATFORM__WINDOWS ) // assuming start.exe is exist __Run( "start test.rtf" ) - ENDIF + #endif RETURN @@ -74,44 +74,31 @@ STATIC FUNCTION new( cfilename ) STATIC FUNCTION write( csource ) LOCAL self := qself() - LOCAL cchar, cline, xatt, i, _xatt - LOCAL n, nchar, xchar, y + LOCAL cchar, cline, xatt, i + LOCAL nchar, y // These are character attributes, self-defined // + means a turn-on // - means a turn-off LOCAL attrib := { ; - { "+b" , "\b " } /* turn bold on*/ - , ; - { "+bu" , "\ul\b " } /* turn bold_underline on */ - , ; - { "+bi" , "\b\i " } /* turn bold_italic on */ - , ; - { "+bui", "\ul\b\i " } /* turn bold_underline_italic on */ - , ; - { "+i" , "\i " } /* turn italic on */ - , ; - { "+il" , "\ul\i " } /* turn italic_underline on */ - , ; - { "+u" , "\ul " } /* turn underline on */ - , ; - { "-b" , "\b0 " } /* turn bold off */ - , ; - { "-bu" , "\b0\ulnone " } /* turn bold_underline off */ - , ; - { "-bi" , "\b0\i0 " } /* turn bold_italic off */ - , ; - { "-bui", "\b0\i0\ulnone " } /* turn bold_underline_italic off */ - , ; - { "-i" , "\i0 " } /* turn italic off */ - , ; - { "-il" , "\ulnone\i0 " } /* turn italic_underline off */ - , ; - { "-u" , "\ulnone " } /* turn underline off */ + { "+b" , "\b " } /* turn bold on*/ , ; + { "+bu" , "\ul\b " } /* turn bold_underline on */, ; + { "+bi" , "\b\i " } /* turn bold_italic on */, ; + { "+bui", "\ul\b\i " } /* turn bold_underline_italic on */, ; + { "+i" , "\i " } /* turn italic on */, ; + { "+il" , "\ul\i " } /* turn italic_underline on */, ; + { "+u" , "\ul " } /* turn underline on */, ; + { "-b" , "\b0 " } /* turn bold off */, ; + { "-bu" , "\b0\ulnone " } /* turn bold_underline off */, ; + { "-bi" , "\b0\i0 " } /* turn bold_italic off */, ; + { "-bui", "\b0\i0\ulnone " } /* turn bold_underline_italic off */, ; + { "-i" , "\i0 " } /* turn italic off */, ; + { "-il" , "\ulnone\i0 " } /* turn italic_underline off */, ; + { "-u" , "\ulnone " } /* turn underline off */; } hb_fuse( csource ) // open source file - WHILE !hb_FEof() // read the file line by line + WHILE ! hb_FEof() // read the file line by line cline := hb_freadln() + "\par" y := Len( cline ) for nchar := 1 TO y @@ -125,20 +112,20 @@ STATIC FUNCTION write( csource ) SubStr( cline, nchar + 1, 1 ) + ; SubStr( cline, nchar + 2, 1 ) + ; SubStr( cline, nchar + 3, 1 ) - IF ( i := AScan( attrib, { |e| e[1] == xatt } ) ) > 0 - FWrite( ::nhandle, attrib[i][2] ) + IF ( i := AScan( attrib, {| e | e[ 1 ] == xatt } ) ) > 0 + FWrite( ::nhandle, attrib[ i ][ 2 ] ) nchar := nchar + Len( xatt ) - 1 ELSE // 3 attributes xatt := Left( xatt, 3 ) - IF ( i := AScan( attrib, { |e| e[1] == xatt } ) ) > 0 - FWrite( ::nhandle, attrib[i][2] ) + IF ( i := AScan( attrib, {| e | e[ 1 ] == xatt } ) ) > 0 + FWrite( ::nhandle, attrib[ i ][ 2 ] ) nchar := nchar + Len( xatt ) - 1 ELSE // 2 attributes xatt := Left( xatt, 2 ) - IF ( i := AScan( attrib, { |e| e[1] == xatt } ) ) > 0 - FWrite( ::nhandle, attrib[i][2] ) + IF ( i := AScan( attrib, {| e | e[ 1 ] == xatt } ) ) > 0 + FWrite( ::nhandle, attrib[ i ][ 2 ] ) nchar := nchar + Len( xatt ) - 1 ELSE FWrite( ::nhandle, cchar ) @@ -154,7 +141,7 @@ STATIC FUNCTION write( csource ) ENDDO hb_fuse() - RETURN ( self ) + RETURN self STATIC FUNCTION CLOSE() diff --git a/harbour/contrib/hbxbp/tests/xbpqtc.prg b/harbour/contrib/hbxbp/tests/xbpqtc.prg index abb99e5ec3..cf963f3762 100644 --- a/harbour/contrib/hbxbp/tests/xbpqtc.prg +++ b/harbour/contrib/hbxbp/tests/xbpqtc.prg @@ -316,7 +316,7 @@ Function CreateInnerChildWindow( oODlg ) oDlg:show() SetAppFocus( oDlg ) - Return( NIL ) + Return NIL /*----------------------------------------------------------------------*/ @@ -344,7 +344,7 @@ Function CreateOuterChildWindow( oODlg, lMoveWithOwner ) SetAppFocus( oDlg ) - Return( NIL ) + Return NIL /*----------------------------------------------------------------------*/ diff --git a/harbour/examples/gfspell/spell.prg b/harbour/examples/gfspell/spell.prg index e830fc4646..67b9e4f819 100644 --- a/harbour/examples/gfspell/spell.prg +++ b/harbour/examples/gfspell/spell.prg @@ -1649,4 +1649,4 @@ ENDIF ret_val := AT(f_str, SUBSTR(l_str, f_rom)) -RETURN(ret_val) +RETURN ret_val diff --git a/harbour/examples/gtwvw/tests/cbtest6.prg b/harbour/examples/gtwvw/tests/cbtest6.prg index ef5f9087e2..0fc7cb7ee9 100644 --- a/harbour/examples/gtwvw/tests/cbtest6.prg +++ b/harbour/examples/gtwvw/tests/cbtest6.prg @@ -254,7 +254,7 @@ FUNCTION CBreader( oGet ) oGet:killfocus() endif -RETURN (NIL) //cbreader() +RETURN NIL //cbreader() /* not used: static function MoveToGet(GetList, nPos) diff --git a/harbour/examples/gtwvw/tests/ebtest7.prg b/harbour/examples/gtwvw/tests/ebtest7.prg index ab2eaadf8f..7fd7874f79 100644 --- a/harbour/examples/gtwvw/tests/ebtest7.prg +++ b/harbour/examples/gtwvw/tests/ebtest7.prg @@ -927,4 +927,4 @@ return win_messagebox(nParent, cMessage, cCaption, nFlags) static function lShiftPressed() // #define VK_SHIFT 16 -return (wvw_GETKEYSTATE(16) < 0) +return wvw_GETKEYSTATE(16) < 0 diff --git a/harbour/examples/gtwvw/tests/prog0.prg b/harbour/examples/gtwvw/tests/prog0.prg index 6ae89d50d1..8eac66c6ca 100644 --- a/harbour/examples/gtwvw/tests/prog0.prg +++ b/harbour/examples/gtwvw/tests/prog0.prg @@ -257,7 +257,7 @@ local oldColor := setcolor(s_cStdColor) setcursor(oldCurs) setcolor(oldColor) -return (nChoice==1) +return nChoice==1 function lBoxMessage(cMsg, cTitle) local nTopLine, ; @@ -335,7 +335,7 @@ FUNCTION ZNEWWINDOW(wtype,r1,c1,r2,c2,ctitle, ccolor) endif SETCOLOR(cOldColor) -RETURN(i+1) +RETURN i+1 FUNCTION ZREVWINDOW() * Closes the last window and remove it from window list @@ -354,7 +354,7 @@ FUNCTION ZREVWINDOW() * remove window from list adel(s_zwin, i) asize(s_zwin, len(s_zwin)-1) -RETURN(NIL) +RETURN NIL function nCeiling(nNumber) local nTemp diff --git a/harbour/examples/gtwvw/tests/prog1.prg b/harbour/examples/gtwvw/tests/prog1.prg index ff0e1dcc4d..a949b7b3b7 100644 --- a/harbour/examples/gtwvw/tests/prog1.prg +++ b/harbour/examples/gtwvw/tests/prog1.prg @@ -281,7 +281,7 @@ local oldColor := setcolor(s_cStdColor) setcursor(oldCurs) setcolor(oldColor) -return (nChoice==1) +return nChoice==1 function lBoxMessage(cMsg, cTitle) local nTopLine, ; @@ -365,7 +365,7 @@ FUNCTION ZNEWWINDOW(wtype,r1,c1,r2,c2,ctitle, ccolor) #ENDIF SETCOLOR(cOldColor) -RETURN(i+1) +RETURN i+1 FUNCTION ZREVWINDOW() * Closes the last window and remove it from window list @@ -388,7 +388,7 @@ FUNCTION ZREVWINDOW() * remove window from list adel(s_zwin, i) asize(s_zwin, len(s_zwin)-1) -RETURN(NIL) +RETURN NIL function nCeiling(nNumber) local nTemp diff --git a/harbour/examples/gtwvw/tests/prog2.prg b/harbour/examples/gtwvw/tests/prog2.prg index 058d0d1dc9..cad83d8d14 100644 --- a/harbour/examples/gtwvw/tests/prog2.prg +++ b/harbour/examples/gtwvw/tests/prog2.prg @@ -322,7 +322,7 @@ local oldColor := setcolor(s_cStdColor) setcursor(oldCurs) setcolor(oldColor) -return (nChoice==1) +return nChoice==1 function lBoxMessage(cMsg, cTitle) local nTopLine, ; @@ -407,7 +407,7 @@ FUNCTION ZNEWWINDOW(wtype,r1,c1,r2,c2,ctitle, ccolor) #ENDIF SETCOLOR(cOldColor) -RETURN(i+1) +RETURN i+1 FUNCTION ZREVWINDOW() * Closes the last window and remove it from window list @@ -431,7 +431,7 @@ FUNCTION ZREVWINDOW() * remove window from list adel(s_zwin, i) asize(s_zwin, len(s_zwin)-1) -RETURN(NIL) +RETURN NIL function nCeiling(nNumber) local nTemp diff --git a/harbour/examples/gtwvw/tests/wvwtest9.prg b/harbour/examples/gtwvw/tests/wvwtest9.prg index f0b630dba6..1fa57238c1 100644 --- a/harbour/examples/gtwvw/tests/wvwtest9.prg +++ b/harbour/examples/gtwvw/tests/wvwtest9.prg @@ -1070,7 +1070,7 @@ return .t. function lYesNo(cMsg, cTitle) default cTitle to "Konfirmasi" -return (win_messagebox(WVW_GETWINDOWHANDLE(), cMsg, cTitle, MB_YESNO + MB_ICONQUESTION + MB_SYSTEMMODAL) == IDYES) +return win_messagebox(WVW_GETWINDOWHANDLE(), cMsg, cTitle, MB_YESNO + MB_ICONQUESTION + MB_SYSTEMMODAL) == IDYES function lDebug(cMsg) return lBoxMessage(cMsg, "Debug") @@ -1181,7 +1181,7 @@ FUNCTION SetDefaultWindowSize() CLS ENDIF ENDIF -RETURN(Result) +RETURN Result //static function isWinNT() //return lYesNo("I am preparing the 'best' font for you..." + CRLF+; diff --git a/harbour/examples/hbapollo/array.prg b/harbour/examples/hbapollo/array.prg index 460278d3cb..c200fc45cd 100644 --- a/harbour/examples/hbapollo/array.prg +++ b/harbour/examples/hbapollo/array.prg @@ -87,7 +87,7 @@ STATIC FUNCTION _ftsavesub( xMemVar, nHandle, nErrorCode ) nLen := Len( xMemVar ) FWrite( nHandle, L2Bin( nLen ), 4 ) IF FError() = 0 - AEval( xMemVar, { |xMemVar1| lRet := _ftsavesub( xMemVar1, nHandle ) } ) + AEval( xMemVar, {| xMemVar1 | lRet := _ftsavesub( xMemVar1, nHandle ) } ) ELSE lRet = .F. ENDIF diff --git a/harbour/examples/hbapollo/tests/test25.prg b/harbour/examples/hbapollo/tests/test25.prg index f61d89d3c8..d74a4ae070 100644 --- a/harbour/examples/hbapollo/tests/test25.prg +++ b/harbour/examples/hbapollo/tests/test25.prg @@ -40,8 +40,8 @@ PROCEDURE MAIN() APPEND BLANK 10000 j := 0 - SX_DBEVAL( { ||; - cPad := PADL( ++ j, 5, "0" ), ; + SX_DBEVAL( {||; + cPad := PADL( ++j, 5, "0" ), ; SX_REPLACEEX( { ; { "MYDATE", date() + j }, ; { "MYCHAR", "NAME_" + cPad }, ; diff --git a/harbour/examples/hbapollo/tests/test34.prg b/harbour/examples/hbapollo/tests/test34.prg index 666108fd8a..7d402728dc 100644 --- a/harbour/examples/hbapollo/tests/test34.prg +++ b/harbour/examples/hbapollo/tests/test34.prg @@ -24,8 +24,8 @@ PROCEDURE MAIN() SET EPOCH 1950 SET DATE "DD/MM/YYYY" - IF File( "C:\WINDOWS\TEMP\myText.Txt" ) - FErase( "C:\WINDOWS\TEMP\myText.Txt" ) + IF File( "mytext.txt" ) + FErase( "mytext.txt" ) ENDIF CREATE DBF cFile STRUCT aStruct RDD SDENSX @@ -61,7 +61,7 @@ Delimiter should be one of the followings: SPACE_DELIM */ - COPYTEXT TO C:\WINDOWS\TEMP\mytext.txt DELIMITED WITH TAB_DELIM + COPYTEXT TO mytext.txt DELIMITED WITH TAB_DELIM // COPYTEXT TO mytext.txt DELIMITED WITH COMMA_DELIM // COPYTEXT TO mytext.txt DELIMITED WITH SDF_DELIM // COPYTEXT TO mytext.txt DELIMITED WITH SPACE_DELIM @@ -71,7 +71,7 @@ Delimiter should be one of the followings: IF !empty( cApplication := appReg( "txt" ) ) ? 'Now will browse text file ... Press any key ...' PAUSE - IF File( "c:\windows\temp\myText.Txt" ) - __run( cApplication + " " + "c:\windows\temp\mytext.txt" ) + IF File( "mytext.txt" ) + __run( cApplication + " " + "mytext.txt" ) ENDIF ENDIF diff --git a/harbour/examples/hbapollo/tests/test35.prg b/harbour/examples/hbapollo/tests/test35.prg index 1fac5beb1b..154487476a 100644 --- a/harbour/examples/hbapollo/tests/test35.prg +++ b/harbour/examples/hbapollo/tests/test35.prg @@ -12,7 +12,7 @@ PROCEDURE MAIN() - LOCAL cFile := "c:\windows\temp\sixtest.dbf" + LOCAL cFile := "sixtest.dbf" LOCAL aStruct := { ; { "MYCHAR" , "C", 15, 0 }, ; { "MYDATE" , "D", 8, 0 }, ; @@ -25,8 +25,8 @@ PROCEDURE MAIN() SET EPOCH 1950 SET DATE "DD/MM/YYYY" - IF File( "c:\windows\temp\myText.Txt" ) - FErase( "c:\windows\temp\myText.Txt" ) + IF File( "mytext.txt" ) + FErase( "mytext.txt" ) ENDIF CREATE DBF cFile STRUCT aStruct RDD SDENSX @@ -68,7 +68,7 @@ PROCEDURE MAIN() // if no FIELDS clause is used, all fields will be printed // COPY TO mytext.txt ; // DELIMITED clause should come last - COPY TO c:\windows\temp\mytext.txt FIELDS MYCHAR, MYDATE, MYNUMBER1, MYNUMBER2, MYMEMO ; + COPY TO mytext.txt FIELDS MYCHAR, MYDATE, MYNUMBER1, MYNUMBER2, MYMEMO ; FOR sx_GetValue( "MYDATE" ) <= CTOD( "31/12/2008" ) ; NEXT 100 DELIMITED WITH CHR( 9 ) @@ -80,14 +80,14 @@ PROCEDURE MAIN() CLOSE ALL - // if file("c:\windows\temp\mytext.txt") - // ? 'File c:\windows\temp\mytext.txt created ...' + // if file("mytext.txt") + // ? 'File mytext.txt created ...' // endif IF !empty( cApplication := appReg( "txt" ) ) ? 'Now will browse text file ... Press any key ...' PAUSE - IF File( "c:\windows\temp\myText.Txt" ) - __Run( cApplication + " " + "c:\windows\temp\mytext.txt" ) + IF File( "mytext.txt" ) + __Run( cApplication + " " + "mytext.txt" ) ENDIF ENDIF diff --git a/harbour/examples/hbapollo/tests/test36.prg b/harbour/examples/hbapollo/tests/test36.prg index a386570edd..6b5ffdd513 100644 --- a/harbour/examples/hbapollo/tests/test36.prg +++ b/harbour/examples/hbapollo/tests/test36.prg @@ -12,7 +12,7 @@ PROCEDURE MAIN() - LOCAL cFile := "c:\windows\temp\sixtest.dbf" + LOCAL cFile := "sixtest.dbf" LOCAL aStruct := { ; { "MYCHAR" , "C", 15, 0 }, ; { "MYDATE" , "D", 8, 0 }, ; @@ -25,8 +25,8 @@ PROCEDURE MAIN() SET EPOCH 1950 SET DATE "DD/MM/YYYY" - IF File( "c:\windows\temp\myText.Txt" ) - FErase( "c:\windows\temp\myText.Txt" ) + IF File( "mytext.txt" ) + FErase( "mytext.txt" ) ENDIF CREATE DBF cFile STRUCT aStruct RDD SDENSX @@ -68,7 +68,7 @@ PROCEDURE MAIN() // if no FIELDS clause is used, all fields will be printed // COPY TO mytext.txt ; // DELIMITED clause should come last - COPY TO c:\windows\temp\mytext.txt SDF FIELDS MYCHAR, MYDATE, MYNUMBER1, MYNUMBER2, MYMEMO ; + COPY TO mytext.txt SDF FIELDS MYCHAR, MYDATE, MYNUMBER1, MYNUMBER2, MYMEMO ; FOR sx_GetValue( "MYDATE" ) <= CTOD( "31/12/2003" ) ; NEXT 100 @@ -80,14 +80,14 @@ PROCEDURE MAIN() CLOSE ALL - // if file("c:\windows\temp\mytext.txt") - // ? 'File c:\windows\temp\mytext.txt created ...' + // if file("mytext.txt") + // ? 'File mytext.txt created ...' // endif IF !empty( cApplication := appReg( "txt" ) ) ? 'Now will browse text file ... Press any key ...' PAUSE - IF File( "c:\windows\temp\myText.Txt" ) - __run( cApplication + " " + "c:\windows\temp\mytext.txt" ) + IF File( "mytext.txt" ) + __run( cApplication + " " + "mytext.txt" ) ENDIF ENDIF diff --git a/harbour/examples/hbapollo/tests/test37.prg b/harbour/examples/hbapollo/tests/test37.prg index f814ccfa8f..9b8f4a9030 100644 --- a/harbour/examples/hbapollo/tests/test37.prg +++ b/harbour/examples/hbapollo/tests/test37.prg @@ -11,7 +11,7 @@ PROCEDURE MAIN() - LOCAL cFile := "c:\windows\temp\sixtest.dbf" + LOCAL cFile := "sixtest.dbf" LOCAL aStruct := { ; { "MYCHAR" , "C", 15, 0 }, ; { "MYDATE" , "D", 8, 0 }, ; @@ -24,8 +24,8 @@ PROCEDURE MAIN() SET EPOCH 1950 SET DATE "DD/MM/YYYY" - IF File( "c:\windows\temp\myText.Txt" ) - FErase( "c:\windows\temp\myText.Txt" ) + IF File( "mytext.txt" ) + FErase( "mytext.txt" ) ENDIF CREATE DBF cFile STRUCT aStruct diff --git a/harbour/examples/hbapollo/tests/test38.prg b/harbour/examples/hbapollo/tests/test38.prg index 08ae998bcc..df2fb600da 100644 --- a/harbour/examples/hbapollo/tests/test38.prg +++ b/harbour/examples/hbapollo/tests/test38.prg @@ -11,7 +11,7 @@ PROCEDURE MAIN() - LOCAL cFile := "c:\windows\temp\sixtest.dbf" + LOCAL cFile := "sixtest.dbf" LOCAL aStruct := { ; { "MYCHAR" , "C", 15, 0 }, ; { "MYDATE" , "D", 8, 0 }, ; @@ -24,8 +24,8 @@ PROCEDURE MAIN() SET EPOCH 1950 SET DATE "DD/MM/YYYY" - IF File( "c:\windows\temp\myText.Txt" ) - FErase( "c:\windows\temp\myText.Txt" ) + IF File( "mytext.txt" ) + FErase( "mytext.txt" ) ENDIF CREATE DBF cFile STRUCT aStruct diff --git a/harbour/examples/hbapollo/tests/test49.prg b/harbour/examples/hbapollo/tests/test49.prg index a3a24913ae..bd71eb6659 100644 --- a/harbour/examples/hbapollo/tests/test49.prg +++ b/harbour/examples/hbapollo/tests/test49.prg @@ -28,7 +28,7 @@ PROCEDURE MAIN() ? 'sx_LockCount() =', __trim( sx_LockCount() ) aLockList := sx_DBRlockList() ? 'aLockList := sx_DBRlockList() =>', __trim( len( aLockList ) ) - aeval( aLockList, { |e, i| outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) + aeval( aLockList, {| e, i | outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) ? ? 'sx_Unlock( 10 ) =', sx_Unlock( 10 ) @@ -42,7 +42,7 @@ PROCEDURE MAIN() ? 'sx_LockCount() =', __trim( sx_LockCount() ) aLockList := sx_DBRlockList() ? 'aLockList := sx_DBRlockList() =>', __trim( len( aLockList ) ) - aeval( aLockList, { |e, i| outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) + aeval( aLockList, {| e, i | outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) ? ? 'sx_Rlock( 10 ) =', sx_Rlock( 10 ) @@ -58,7 +58,7 @@ PROCEDURE MAIN() ? 'sx_LockCount() =', __trim( sx_LockCount() ) aLockList := sx_DBRlockList() ? 'aLockList := sx_DBRlockList() =>', __trim( len( aLockList ) ) - aeval( aLockList, { |e, i| outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) + aeval( aLockList, {| e, i | outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) sx_UnLockAll() @@ -67,7 +67,7 @@ PROCEDURE MAIN() ? 'sx_LockCount() =', __trim( sx_LockCount() ) aLockList := sx_DBRlockList() ? 'aLockList := sx_DBRlockList() =>', __trim( len( aLockList ) ) - aeval( aLockList, { |e, i| outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) + aeval( aLockList, {| e, i | outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) ? sx_LastRec() @@ -77,7 +77,7 @@ PROCEDURE MAIN() ? 'sx_LockCount() =', __trim( sx_LockCount() ) aLockList := sx_DBRlockList() ? 'aLockList := sx_DBRlockList() =>', __trim( len( aLockList ) ) - aeval( aLockList, { |e, i| outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) + aeval( aLockList, {| e, i | outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) ? ? 'sx_DbrUnLock( aLockList ) =', sx_DbrUnLock( aLockList ) // ? 'sx_UnLock( aLockList ) =', sx_UnLock( aLockList ) @@ -85,7 +85,7 @@ PROCEDURE MAIN() ? 'sx_LockCount() =', __trim( sx_LockCount() ) aLockList := sx_DBRlockList() ? 'aLockList := sx_DBRlockList() =>', __trim( len( aLockList ) ) - aeval( aLockList, { |e, i| outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) + aeval( aLockList, {| e, i | outstd( "aLockList[" + __trim(i ) + "] = " + __trim(e ), hb_eol() ) } ) ? 'sx_LastRec() =', sx_LastRec() ? 'sx_RecCount() =', sx_RecCount() diff --git a/harbour/examples/hbapollo/tests/test53.prg b/harbour/examples/hbapollo/tests/test53.prg index 0d41e075b3..3033e4d878 100644 --- a/harbour/examples/hbapollo/tests/test53.prg +++ b/harbour/examples/hbapollo/tests/test53.prg @@ -85,7 +85,7 @@ FUNCTION Test_1( nCommit ) APPEND BLANK 10000 j := 0 sx_DbEval( ; - { || cPad := PADL( ++ j, 5, "0" ) , ; + {|| cPad := PADL( ++j, 5, "0" ) , ; sx_ReplaceEx( { ; { "MYCHAR", "NAME_" + cPad } , ; { "MYDATE", date() + j } , ; diff --git a/harbour/examples/hbapollo/tests/test56.prg b/harbour/examples/hbapollo/tests/test56.prg index 6655f9220b..0fa998f228 100644 --- a/harbour/examples/hbapollo/tests/test56.prg +++ b/harbour/examples/hbapollo/tests/test56.prg @@ -10,7 +10,7 @@ PROCEDURE MAIN() - LOCAL cFile := "c:\windows\temp\sixtest.dbf" + LOCAL cFile := "sixtest.dbf" LOCAL aStruct := { ; { "FIRST", "C", 25, 0 }, ; { "LAST", "C", 25, 0 }, ; diff --git a/harbour/examples/hbapollo/tests/test57.prg b/harbour/examples/hbapollo/tests/test57.prg index 326bce6d31..8ae6b94bf3 100644 --- a/harbour/examples/hbapollo/tests/test57.prg +++ b/harbour/examples/hbapollo/tests/test57.prg @@ -10,7 +10,7 @@ PROCEDURE MAIN() - LOCAL cFile := "c:\windows\temp\sixtest.dbf" + LOCAL cFile := "sixtest.dbf" LOCAL aStruct := { ; { "FIRST", "C", 25, 0 }, ; { "LAST", "C", 25, 0 }, ; diff --git a/harbour/examples/hbapollo/tests/test58.prg b/harbour/examples/hbapollo/tests/test58.prg index ddcbfc8f96..6be0ba46a0 100644 --- a/harbour/examples/hbapollo/tests/test58.prg +++ b/harbour/examples/hbapollo/tests/test58.prg @@ -11,7 +11,7 @@ PROCEDURE MAIN() - LOCAL cFile := "c:\windows\temp\sixtest.dbf" + LOCAL cFile := "sixtest.dbf" LOCAL aStruct := { ; { "FIRST", "C", 25, 0 }, ; { "LAST", "C", 25, 0 }, ; diff --git a/harbour/examples/hbapollo/tests/test65.prg b/harbour/examples/hbapollo/tests/test65.prg index 570c54a526..9cae349d9c 100644 --- a/harbour/examples/hbapollo/tests/test65.prg +++ b/harbour/examples/hbapollo/tests/test65.prg @@ -14,15 +14,15 @@ PROCEDURE MAIN() LOCAL s, t LOCAL aStruct1 := { { "NO","C",5,0 }, { "BINARY","M",10,0 } } - SET DATE "dd/mm/yyyy" + SET DATE ANSI CREATE TABLE "TEST1" STRUCT aStruct1 RDD SDEFOX USE "test1" ALIAS ONE RDD SDEFOX APPEND BLANK REPLACE NO WITH "001" - IF File( "C:\WINDOWS\SYSTEM.INI" ) - sx_ReplaceBLOB( "BINARY", "C:\WINDOWS\SYSTEM.INI" ) + IF File( GetEnv( "WINDIR" ) + "\SYSTEM.INI" ) + sx_ReplaceBLOB( "BINARY", GetEnv( "WINDIR" ) + "\SYSTEM.INI" ) sx_Commit() ? sx_BLOBToFile( "BINARY", "test.ini" ) ELSE - ? "File C:\WINDOWS\SYSTEM.INI required for testing. Not found." + ? "File " + GetEnv( "WINDIR" ) + "\SYSTEM.INI required for testing. Not found." ENDIF diff --git a/harbour/examples/hbapollo/tests/test66.prg b/harbour/examples/hbapollo/tests/test66.prg index f11a5cc09c..2de046890d 100644 --- a/harbour/examples/hbapollo/tests/test66.prg +++ b/harbour/examples/hbapollo/tests/test66.prg @@ -14,17 +14,17 @@ PROCEDURE MAIN() LOCAL s, t LOCAL aStruct1 := { { "NO","C",5,0 }, { "BINARY","M",10,0 } } - SET DATE "dd/mm/yyyy" + SET DATE ANSI CREATE TABLE "TEST1" STRUCT aStruct1 RDD SDENSX USE "test1" ALIAS ONE RDD SDENSX //CREATE TABLE "TEST1" STRUCT aStruct1 RDD SDEFOX //use "test1" alias ONE RDD SDEFOX APPEND BLANK REPLACE NO WITH "001" - IF file( "C:\WINDOWS\ACD Wallpaper.bmp" ) - sx_ReplaceBitmap( "BINARY", "C:\WINDOWS\ACD Wallpaper.bmp" ) + IF file( GetEnv( "WINDIR" ) + "\ACD Wallpaper.bmp" ) + sx_ReplaceBitmap( "BINARY", GetEnv( "WINDIR" ) + ""\ACD Wallpaper.bmp" ) sx_Commit() ? sx_BLOBToFile( "BINARY", "test.bmp" ) ELSE - ? "File C:\WINDOWS\setup.bmp required for testing. Not found!" + ? "File " + GetEnv( "WINDIR" ) + "\ACD Wallpaper.bmp required for testing. Not found!" ENDIF diff --git a/harbour/examples/hbapollo/tests/test77.prg b/harbour/examples/hbapollo/tests/test77.prg index 8a4686824c..78c887fb7c 100644 --- a/harbour/examples/hbapollo/tests/test77.prg +++ b/harbour/examples/hbapollo/tests/test77.prg @@ -15,16 +15,16 @@ PROCEDURE MAIN() LOCAL s, t LOCAL aStruct1 := { { "NO","C",5,0 }, { "BINARY","M",10,0 } } - SET DATE "dd/mm/yyyy" + SET DATE ANSI CREATE TABLE "TEST1" STRUCT aStruct1 RDD SDEFOX USE "test1" ALIAS ONE RDD SDEFOX APPEND BLANK REPLACE NO WITH "001" - IF File( "C:\WINDOWS\SYSTEM.INI" ) - sx_ReplaceBLOB( "BINARY", "C:\WINDOWS\SYSTEM.INI" ) + IF File( GetEnv( "WINDIR" ) + "\SYSTEM.INI" ) + sx_ReplaceBLOB( "BINARY", GetEnv( "WINDIR" ) + "\SYSTEM.INI" ) sx_Commit() ? 'sx_GetBlobLength( "BINARY" ) =>', sx_GetBlobLength( "BINARY" ) ? 'sx_BLOBToFile( "BINARY", "test.ini" ) =>', sx_BLOBToFile( "BINARY", "test.ini" ) ELSE - ? "File C:\WINDOWS\SYSTEM.INI required for testing. Not found." + ? "File " + GetEnv( "WINDIR" ) + "\SYSTEM.INI required for testing. Not found." ENDIF diff --git a/harbour/examples/hbvpdf/hbvpdf.prg b/harbour/examples/hbvpdf/hbvpdf.prg index 9d6a6623dc..dc8dfcb998 100644 --- a/harbour/examples/hbvpdf/hbvpdf.prg +++ b/harbour/examples/hbvpdf/hbvpdf.prg @@ -2342,7 +2342,7 @@ local nSpace // := 3 // 3 - RGB, 1 - GREY, 4 - CMYK return aTemp STATIC FUNCTION FilePos( nHandle ) -RETURN ( FSEEK( nHandle, 0, FS_RELATIVE ) ) +RETURN FSEEK( nHandle, 0, FS_RELATIVE ) STATIC FUNCTION Chr_RGB( cChar ) RETURN str(asc( cChar ) / 255, 4, 2) @@ -2416,7 +2416,7 @@ STATIC FUNCTION FileSize( nHandle ) // Reset file position FSEEK( nHandle, nCurrent ) -RETURN ( nLength ) +RETURN nLength // next 3 function written by Peter Kulek //modified for compatibility with common.ch by V.K. diff --git a/harbour/examples/hbxlsxml/xlsxml.prg b/harbour/examples/hbxlsxml/xlsxml.prg index 7be3852cb3..9c22816789 100644 --- a/harbour/examples/hbxlsxml/xlsxml.prg +++ b/harbour/examples/hbxlsxml/xlsxml.prg @@ -9,7 +9,7 @@ * www - http://www.xharbour.org http://harbour-project.org * * Thanks TO Robert F Greer, PHP original version - * http://sourceforge.net/projects/excelwriterxml/ + * http://sourceforge.net/projects/excelwriterxml/ * * This program is free software; you can redistribute it AND/OR modify * it under the terms of the GNU General PUBLIC License as published by @@ -65,52 +65,52 @@ CREATE CLASS ExcelWriterXML DATA sheets INIT {} DATA lShowErrorSheet INIT .f. DATA overwriteFile INIT .f. - DATA docFileName - DATA cDocTitle - DATA cDocSubject - DATA cDocAuthor - DATA cDocCreated - DATA cDocManager - DATA cDocCompany + DATA docFileName + DATA cDocTitle + DATA cDocSubject + DATA cDocAuthor + DATA cDocCreated + DATA cDocManager + DATA cDocCompany DATA cDocVersion INIT "11.9999" DATA cError INIT "" DATA errors INIT .f. - + METHOD New( fileName ) - METHOD setOverwriteFile( overwrite ) - METHOD showErrorSheet( show ) - METHOD addError( cFunction, cMessage ) - METHOD getDefaultStyle() - METHOD addStyle( id ) - METHOD addSheet( id ) - METHOD checkSheetID( id ) - METHOD checkStyleID( id ) + METHOD setOverwriteFile( overwrite ) + METHOD showErrorSheet( show ) + METHOD addError( cFunction, cMessage ) + METHOD getDefaultStyle() + METHOD addStyle( id ) + METHOD addSheet( id ) + METHOD checkSheetID( id ) + METHOD checkStyleID( id ) METHOD writeData( target ) - METHOD docTitle( title ) - METHOD docSubject( subject ) - METHOD docAuthor( author ) - METHOD docManager( manager ) - METHOD docCompany( company ) - - ENDCLASS + METHOD docTitle( title ) + METHOD docSubject( subject ) + METHOD docAuthor( author ) + METHOD docManager( manager ) + METHOD docCompany( company ) + + ENDCLASS /*----------------------------------------------------------------------*/ - + METHOD ExcelWriterXML:new( fileName ) LOCAL style - + style := ::addStyle( 'DEFAULT' ) style:name( 'Normal' ) style:alignVertical( 'Bottom' ) - + IF empty( fileName ) fileName := 'file.xml' ENDIF - + ::docFileName := fileName ::cDocCreated := DTOS( DATE() ) + 'T' + TIME() + 'Z' - + RETURN SELF /*----------------------------------------------------------------------*/ @@ -122,92 +122,92 @@ METHOD ExcelWriterXML:setOverwriteFile( overwrite ) ELSE ::overwriteFile := overwrite ENDIF - + RETURN NIL /*----------------------------------------------------------------------*/ - + METHOD ExcelWriterXML:showErrorSheet( show ) IF ! ( VALTYPE( show ) == "L" ) ::lShowErrorSheet := .t. ELSE ::lShowErrorSheet := show - ENDIF - + ENDIF + RETURN NIL /*----------------------------------------------------------------------*/ METHOD ExcelWriterXML:addError( cFunction, cMessage ) LOCAL tmp - + tmp := { 'FUNCTION' => cFunction,; 'MESSAGE' => cMessage } - + ::formatErrors += tmp - + RETURN NIL - + /*----------------------------------------------------------------------*/ - + METHOD ExcelWriterXML:getDefaultStyle() RETURN ::styles[ 1 ] /*----------------------------------------------------------------------*/ - -METHOD ExcelWriterXML:addStyle( id ) + +METHOD ExcelWriterXML:addStyle( id ) LOCAL style STATIC styleNum := 1 - + IF alltrim( id ) == '' id := NIL ENDIF - + IF id == NIL id := 'CustomStyle' + ALLTRIM( STR( styleNum, 3 ) ) styleNum++ ENDIF - + WHILE ! ::checkStyleID( id ) id := 'CustomStyle' + ALLTRIM( STR( styleNum, 3 ) ) styleNum++ ENDDO - + style := ExcelWriterXML_Style():new( id ) AADD( ::styles, style ) - + RETURN style - + /*----------------------------------------------------------------------*/ - -METHOD ExcelWriterXML:addSheet( id ) + +METHOD ExcelWriterXML:addSheet( id ) LOCAL sheet - + STATIC sheetNum:= 1 - + IF id == NIL id := 'Sheet' + ALLTRIM( STR( sheetNum, 3 ) ) sheetNum++ ENDIF - + WHILE ! ::checkSheetID( id ) id := 'Sheet' + ALLTRIM( STR( sheetNum, 3 ) ) sheetNum++ ENDDO - - sheet := ExcelWriterXML_Sheet():New( id ) + + sheet := ExcelWriterXML_Sheet():New( id ) AADD( ::sheets, sheet ) - - RETURN sheet + + RETURN sheet /*----------------------------------------------------------------------*/ - + METHOD ExcelWriterXML:checkSheetID( id ) LOCAL sheet - + IF len( ::sheets ) > 0 FOR EACH sheet IN ::sheets IF id == sheet:getID() @@ -217,16 +217,16 @@ METHOD ExcelWriterXML:checkSheetID( id ) ELSE RETURN .t. ENDIF - + RETURN .t. /*----------------------------------------------------------------------*/ - + METHOD ExcelWriterXML:checkStyleID( id ) LOCAL style - + IF LEN( ::styles ) > 0 - FOR EACH style IN ::styles + FOR EACH style IN ::styles IF id == style:getID() RETURN .f. ENDIF @@ -234,27 +234,27 @@ METHOD ExcelWriterXML:checkStyleID( id ) ELSE RETURN .t. ENDIF - + RETURN .t. /*----------------------------------------------------------------------*/ - + METHOD ExcelWriterXML:writeData( target ) LOCAL style, sheet, xml := "", handle, fileExists, format - + LOCAL docTitle := '' LOCAL docSubject := '' LOCAL docAuthor := '' LOCAL docCreated := '' LOCAL docManager := '' LOCAL docCompany := '' - + IF target == NIL ::cError := "Target filename missing!" ::errors := .t. RETURN .t. - ENDIF - + ENDIF + fileExists := hb_fileExists( target ) IF ( fileExists == .t. .AND. ::overwriteFile == .f. ) ::cError := target + " exists and overwriteFile is set to false" @@ -267,29 +267,29 @@ METHOD ExcelWriterXML:writeData( target ) ::errors := .t. RETURN .f. ENDIF - + IF ::lShowErrorSheet == .t. format := ::addStyle( "formatErrorsHeader" ) format:setFontBold() format:bgColor( "red" ) ENDIF - + IF ! empty( ::cDocTitle ); docTitle := "