From 04dfdfac431b61e5c64d1ee8d5aae6f7666f6b6b Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 1 Nov 2012 17:14:00 +0000 Subject: [PATCH] 2012-11-01 18:12 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbxpp/xppopc.c * contrib/xhb/xcstr.prg * contrib/xhb/xhbmsgs.c * extras/hbdoc/hbdoc.prg * extras/hbdoc/tmplates.prg * utils/hbmk2/hbmk2.prg * avoid #undef * ChangeLog * added missing change to prev: * src/common/hbver.c * use {;} for empty loop body ; TODO: Use one common syntax for empty blocks. Harbour currently uses these: {}, { ; }, {;}, {}; --- harbour/ChangeLog | 27 ++++++++++++++++++- harbour/contrib/hbxpp/xppopc.c | 11 ++++---- harbour/contrib/xhb/xcstr.prg | 2 +- harbour/contrib/xhb/xhbmsgs.c | 11 ++++---- harbour/extras/hbdoc/hbdoc.prg | 11 +++----- harbour/extras/hbdoc/tmplates.prg | 44 ++++++++++++------------------- harbour/utils/hbmk2/hbmk2.prg | 3 ++- 7 files changed, 60 insertions(+), 49 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7c65928296..63c5683bb5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,26 @@ The license applies to all entries newer than 2009-04-28. */ +2012-11-01 18:12 UTC+0100 Viktor Szakats (harbour syenar.net) + * contrib/hbxpp/xppopc.c + * contrib/xhb/xcstr.prg + * contrib/xhb/xhbmsgs.c + * extras/hbdoc/hbdoc.prg + * extras/hbdoc/tmplates.prg + * utils/hbmk2/hbmk2.prg + * avoid #undef + + * ChangeLog + * added missing change to prev: + * src/common/hbver.c + * use {;} for empty loop body + ; TODO: Use one common syntax for empty blocks. + Harbour currently uses these: + {}, { ; }, {;}, {}; + +2012-11-01 17:41 UTC+0100 Viktor Szakats (harbour syenar.net) + * ChangeLog + 2012-11-01 17:33 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/gtwvg/tests/demowvg.prg * contrib/gtwvg/tests/wvtcls.prg @@ -27,7 +47,6 @@ * contrib/hbnf/doc/en/video1.txt * contrib/hbnf/tests/metaph.prg * contrib/xhb/trpc.prg - * src/common/hbver.c * src/rtl/gtchrmap.c * tests/dttest.prg * tests/mousetst.prg @@ -36,6 +55,12 @@ * minor formatting and cleanups in docs * use ANSI dates + * src/common/hbver.c + * use {;} for empty loop body + ; TODO: Use one common syntax for empty blocks. + Harbour currently uses these: + {}, { ; }, {;}, {}; + 2012-11-01 16:04 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbexpat/core.c * minor change to avoid uncrustify formatting a tricky macro diff --git a/harbour/contrib/hbxpp/xppopc.c b/harbour/contrib/hbxpp/xppopc.c index b4d23596e4..ff1f1111b2 100644 --- a/harbour/contrib/hbxpp/xppopc.c +++ b/harbour/contrib/hbxpp/xppopc.c @@ -60,8 +60,7 @@ * in Xbase++ compatibility mode where negative indexes are used to access * data from tail */ -#undef HB_IS_VALID_INDEX -#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) ( idx ) < 0 ? ( idx ) += ( max ) + 1 : ( idx ) ) > 0 && ( HB_SIZE ) ( idx ) <= ( max ) ) +#define XHB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) ( idx ) < 0 ? ( idx ) += ( max ) + 1 : ( idx ) ) > 0 && ( HB_SIZE ) ( idx ) <= ( max ) ) HB_FUNC( XPP_INDEX ) { @@ -77,7 +76,7 @@ HB_FUNC( XPP_INDEX ) if( HB_IS_ARRAY( pSelf ) ) { HB_SIZE nLen = hb_arrayLen( pSelf ); - if( HB_IS_VALID_INDEX( nIndex, nLen ) ) + if( XHB_IS_VALID_INDEX( nIndex, nLen ) ) hb_itemMoveRef( hb_arrayGetItemPtr( pSelf, nIndex ), pValue ); else hb_errRT_BASE( EG_BOUND, 1012, "Error in array index", hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); @@ -85,7 +84,7 @@ HB_FUNC( XPP_INDEX ) else if( HB_IS_STRING( pSelf ) ) { HB_SIZE nLen = hb_itemGetCLen( pSelf ); - if( HB_IS_VALID_INDEX( nIndex, nLen ) ) + if( XHB_IS_VALID_INDEX( nIndex, nLen ) ) { char cValue = HB_IS_STRING( pValue ) ? hb_itemGetCPtr( pValue )[ 0 ] : ( char ) hb_itemGetNI( pValue ); @@ -118,7 +117,7 @@ HB_FUNC( XPP_INDEX ) if( HB_IS_ARRAY( pSelf ) ) { HB_SIZE nLen = hb_arrayLen( pSelf ); - if( HB_IS_VALID_INDEX( nIndex, nLen ) ) + if( XHB_IS_VALID_INDEX( nIndex, nLen ) ) hb_itemReturn( hb_arrayGetItemPtr( pSelf, nIndex ) ); else hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */ @@ -126,7 +125,7 @@ HB_FUNC( XPP_INDEX ) else if( HB_IS_STRING( pSelf ) ) { HB_SIZE nLen = hb_itemGetCLen( pSelf ); - if( HB_IS_VALID_INDEX( nIndex, nLen ) ) + if( XHB_IS_VALID_INDEX( nIndex, nLen ) ) hb_retclen( hb_itemGetCPtr( pSelf ) + nIndex - 1, 1 ); else hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */ diff --git a/harbour/contrib/xhb/xcstr.prg b/harbour/contrib/xhb/xcstr.prg index 113ecf3279..0cb099c104 100644 --- a/harbour/contrib/xhb/xcstr.prg +++ b/harbour/contrib/xhb/xcstr.prg @@ -57,7 +57,7 @@ For performance NOT using OS indpendant R/T function, this define only used in ValTpPrg() which currently only used in win32. */ -#undef CRLF + #define CRLF Chr( 13 ) + Chr( 10 ) #xtranslate THROW( ) => ( Eval( ErrorBlock(), ), Break( ) ) diff --git a/harbour/contrib/xhb/xhbmsgs.c b/harbour/contrib/xhb/xhbmsgs.c index 566b5a5076..ddcd3bcd23 100644 --- a/harbour/contrib/xhb/xhbmsgs.c +++ b/harbour/contrib/xhb/xhbmsgs.c @@ -308,8 +308,7 @@ HB_FUNC( XHB_GREATEREQ ) * in xHarbour compatibility mode where negative indexes are used to access * data from tail */ -#undef HB_IS_VALID_INDEX -#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) ( idx ) < 0 ? ( idx ) += ( max ) + 1 : ( idx ) ) > 0 && ( HB_SIZE ) ( idx ) <= ( max ) ) +#define XHB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) ( idx ) < 0 ? ( idx ) += ( max ) + 1 : ( idx ) ) > 0 && ( HB_SIZE ) ( idx ) <= ( max ) ) HB_FUNC( XHB_INDEX ) { @@ -325,7 +324,7 @@ HB_FUNC( XHB_INDEX ) if( HB_IS_ARRAY( pSelf ) ) { HB_SIZE nLen = hb_arrayLen( pSelf ); - if( HB_IS_VALID_INDEX( nIndex, nLen ) ) + if( XHB_IS_VALID_INDEX( nIndex, nLen ) ) hb_itemMoveRef( hb_arrayGetItemPtr( pSelf, nIndex ), pValue ); else hb_errRT_BASE( EG_BOUND, 1133, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); @@ -333,7 +332,7 @@ HB_FUNC( XHB_INDEX ) else if( HB_IS_STRING( pSelf ) ) { HB_SIZE nLen = hb_itemGetCLen( pSelf ); - if( HB_IS_VALID_INDEX( nIndex, nLen ) ) + if( XHB_IS_VALID_INDEX( nIndex, nLen ) ) { char cValue = HB_IS_STRING( pValue ) ? hb_itemGetCPtr( pValue )[ 0 ] : ( char ) hb_itemGetNI( pValue ); @@ -366,7 +365,7 @@ HB_FUNC( XHB_INDEX ) if( HB_IS_ARRAY( pSelf ) ) { HB_SIZE nLen = hb_arrayLen( pSelf ); - if( HB_IS_VALID_INDEX( nIndex, nLen ) ) + if( XHB_IS_VALID_INDEX( nIndex, nLen ) ) hb_itemReturn( hb_arrayGetItemPtr( pSelf, nIndex ) ); else hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); @@ -374,7 +373,7 @@ HB_FUNC( XHB_INDEX ) else if( HB_IS_STRING( pSelf ) ) { HB_SIZE nLen = hb_itemGetCLen( pSelf ); - if( HB_IS_VALID_INDEX( nIndex, nLen ) ) + if( XHB_IS_VALID_INDEX( nIndex, nLen ) ) hb_retclen( hb_itemGetCPtr( pSelf ) + nIndex - 1, 1 ); else hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); diff --git a/harbour/extras/hbdoc/hbdoc.prg b/harbour/extras/hbdoc/hbdoc.prg index 0eddace41f..2a15bbe9a3 100644 --- a/harbour/extras/hbdoc/hbdoc.prg +++ b/harbour/extras/hbdoc/hbdoc.prg @@ -106,6 +106,10 @@ REQUEST HB_GT_CGI_DEFAULT #define BASE_DIR ".." + hb_ps() + ".." + hb_ps() +#define OnOrOff( b ) iif( b, "excluded", "included" ) +#define YesOrNo( b ) iif( b, "yes", "no" ) +#define IsDefault( b ) iif( b, "; default", "" ) + STATIC sc_aExclusions := { "class_tp.txt", "hdr_tpl.txt" } MEMVAR p_hsSwitches @@ -918,10 +922,6 @@ PROCEDURE ShowHelp( cExtraMessage, aArgs ) LOCAL nMode := 1 -#define OnOrOff( b ) iif( b, "excluded", "included" ) -#define YesOrNo( b ) iif( b, "yes", "no" ) -#define IsDefault( b ) iif( b, "; default", "" ) - LOCAL aHelp DO CASE @@ -989,9 +989,6 @@ PROCEDURE ShowHelp( cExtraMessage, aArgs ) ENDCASE -#undef OnOrOff -#undef YesOrNo - // using hbmk2 style AEval( aHelp, {| x | ShowSubHelp( x, @nMode, 0 ) } ) diff --git a/harbour/extras/hbdoc/tmplates.prg b/harbour/extras/hbdoc/tmplates.prg index f2666a579f..0242cb6ae4 100644 --- a/harbour/extras/hbdoc/tmplates.prg +++ b/harbour/extras/hbdoc/tmplates.prg @@ -87,39 +87,29 @@ CREATE CLASS Entry { "END", "End" } ; } -#define S TPL_START -#define E TPL_END -#define T TPL_TEMPLATE -#define R TPL_REQUIRED -#define O TPL_OPTIONAL -#define P TPL_PREFORMATTED -#define U TPL_OUTPUT -#define x 0 +#define _S TPL_START +#define _E TPL_END +#define _T TPL_TEMPLATE +#define _R TPL_REQUIRED +#define _O TPL_OPTIONAL +#define _P TPL_PREFORMATTED +#define _U TPL_OUTPUT // this is best viewed with a fixed-width font // the columns of this array correspond to the elements of Fields CLASS VAR Templates AS ARRAY INIT { ; - { "Template" , { S, T, x+U, x, O , x+U, x+U, x+U, x+U, x+U, x+U, x+U, x+U, x+U, x +U, x +U, x+U, x+U, x+U, x+U, x+U, E } }, ; - { "Document" , { S, T, R+U, R, O+U, O+U, x+U, x+U, x+U, R+U, x+U, x+U, x+U, x+U, x +U, x +U, x+U, x+U, O+U, O+U, O+U, E } }, ; - { "Function" , { S, T, R+U, R, R , O+U, O+U, O+U, O+U, O+U, x+U, x+U, x+U, x+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; - { "C Function" , { S, T, R+U, R, R , O+U, O+U, O+U, O+U, O+U, x+U, x+U, x+U, x+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; - { "Procedure" , { S, T, R+U, R, R , O+U, O+U, O+U, x, O+U, x+U, x+U, x+U, x+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; - { "Command" , { S, T, R+U, R, R , O+U, R+U, R+U, x+U, R+U, x+U, x+U, x+U, x+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; - { "Class" , { S, T, R+U, R, R , O+U, R+U, R+U, R+U, R+U, O+U, O+U, O+U, O+U, P+O+U, P+O+U, O+U, O+U, O+U, O+U, O+U, E } }, ; - { "Class method" , { S, T, R+U, R, R , O+U, R+U, R+U, R+U, R+U, x+U, x+U, x+U, x+U, P+O+U, x +U, x+U, x+U, x+U, x+U, O+U, E } }, ; - { "Class data" , { S, T, R+U, R, R , O+U, R+U, x+U, x+U, R+U, x+U, x+U, x+U, x+U, P+O+U, x +U, x+U, x+U, x+U, x+U, O+U, E } }, ; - { "Run time error", { S, T, R+U, R, x , O+U, x+U, x+U, x+U, R+U, x+U, x+U, x+U, x+U, P+O+U, x +U, x+U, O+U, x+U, x+U, O+U, E } }, ; + { "Template" , { _S, _T, 0+_U, 0, _O , 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0 +_U, 0 +_U, 0+_U, 0+_U, 0+_U, 0+_U, 0+_U, _E } }, ; + { "Document" , { _S, _T, _R+_U, _R, _O+_U, _O+_U, 0+_U, 0+_U, 0+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, 0 +_U, 0 +_U, 0+_U, 0+_U, _O+_U, _O+_U, _O+_U, _E } }, ; + { "Function" , { _S, _T, _R+_U, _R, _R , _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ; + { "C Function" , { _S, _T, _R+_U, _R, _R , _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ; + { "Procedure" , { _S, _T, _R+_U, _R, _R , _O+_U, _O+_U, _O+_U, 0, _O+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ; + { "Command" , { _S, _T, _R+_U, _R, _R , _O+_U, _R+_U, _R+_U, 0+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ; + { "Class" , { _S, _T, _R+_U, _R, _R , _O+_U, _R+_U, _R+_U, _R+_U, _R+_U, _O+_U, _O+_U, _O+_U, _O+_U, _P+_O+_U, _P+_O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _O+_U, _E } }, ; + { "Class method" , { _S, _T, _R+_U, _R, _R , _O+_U, _R+_U, _R+_U, _R+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, 0 +_U, 0+_U, 0+_U, 0+_U, 0+_U, _O+_U, _E } }, ; + { "Class data" , { _S, _T, _R+_U, _R, _R , _O+_U, _R+_U, 0+_U, 0+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, 0 +_U, 0+_U, 0+_U, 0+_U, 0+_U, _O+_U, _E } }, ; + { "Run time error", { _S, _T, _R+_U, _R, 0 , _O+_U, 0+_U, 0+_U, 0+_U, _R+_U, 0+_U, 0+_U, 0+_U, 0+_U, _P+_O+_U, 0 +_U, 0+_U, _O+_U, 0+_U, 0+_U, _O+_U, _E } }, ; } -#undef S -#undef E -#undef T -#undef R -#undef O -#undef P -#undef U -#undef x - METHOD New( cType ) CONSTRUCTOR METHOD IsField( c, nType ) METHOD IsTemplate( cType ) diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 5b0fecbfe2..7b17f5fd21 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -168,8 +168,9 @@ EXTERNAL HB_GT_CGI_DEFAULT EXTERNAL hbmk_KEYW /* needed for -u */ -#undef HB_SYMBOL_UNUSED +#ifndef HB_SYMBOL_UNUSED #define HB_SYMBOL_UNUSED( symbol ) ( ( symbol ) ) +#endif #define _SELF_NAME_ "hbmk2"