diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c08fb99dea..7937395973 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,60 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-06 18:46 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * include/hbdefs.h + + Added HB_ISALNUM() macro. + + * include/hbpp.h + * include/hbapicdp.h + * contrib/hbct/pos1.c + * contrib/hbct/ascpos.c + * contrib/xhb/hbxml.c + * contrib/hbtip/utils.c + * contrib/examples/pp/hbppcore.c + * source/vm/itemapi.c + * source/vm/memvars.c + * source/vm/set.c + * source/vm/classes.c + * source/debug/dbgentry.c + * source/common/hbstr.c + * source/common/expropt2.c + * source/rtl/strcase.c + * source/rtl/cdpapi.c + * source/rtl/is.c + * source/rtl/transfrm.c + * source/rtl/dates.c + * source/rtl/natmsg.c + * source/rtl/soundex.c + * source/rtl/hbffind.c + * source/rdd/workarea.c + * source/compiler/hbmain.c + * source/compiler/harbour.yyc + * source/compiler/harbour.y + * Replaced: + isdigit() -> HB_ISDIGIT() + isalpha() -> HB_ISALPHA() + isalnum() -> HB_ISALNUM() + isupper() -> HB_ISUPPER() + islower() -> HB_ISLOWER() + tolower() -> HB_TOLOWER() + toupper() -> HB_TOUPPER() + + * source/rtl/natmsg.c + ! Fixed to use CP sensitive case conversion in + __NATISNEGATIVE() and __NATISAFFIRM(). + + * source/rtl/is.c + ! Fixed typo in recently added hb_charIsUpper()/hb_charIsLower() + functions. + + ; TODO: Remove DJGPP to*() hack. + ; TODO: Replace HB_PP_UPPER(), HB_PP_ISDIGIT() with equivalent + new macros. + ; TOFIX: Some of the above macros should better be replaced + by CP sensitive versions. F.e. the one in hbtip. + ; TOFIX: Remove remaining #include lines. + 2009-02-06 17:46 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * include/hbdefs.h + Added macros: diff --git a/harbour/contrib/examples/pp/hbppcore.c b/harbour/contrib/examples/pp/hbppcore.c index 5bd08efa0b..f61ff1c5ec 100644 --- a/harbour/contrib/examples/pp/hbppcore.c +++ b/harbour/contrib/examples/pp/hbppcore.c @@ -355,7 +355,7 @@ void hb_pp_Free( void ) hb_pp_aCondCompile = NULL; } hb_pp_InternalFree(); - + if( s_expreal ) { hb_xfree( ( void *) s_expreal ); @@ -871,9 +871,9 @@ static COMMANDS *ComSearch( char *cmdname, COMMANDS * stcmdStart ) { int j; - for( j = 0; ( *( stcmd->name + j ) == toupper( *( cmdname + j ) ) ) && + for( j = 0; ( *( stcmd->name + j ) == HB_TOUPPER( *( cmdname + j ) ) ) && ( *( stcmd->name + j ) != '\0' ) && ( ( stcmd->com_or_xcom ) ? 1 : ( j < 4 || ISNAME( ( BYTE ) * ( cmdname + j + 1 ) ) ) ); j++ ) ; - if( ( *( stcmd->name + j ) == toupper( *( cmdname + j ) ) ) + if( ( *( stcmd->name + j ) == HB_TOUPPER( *( cmdname + j ) ) ) || ( !stcmd->com_or_xcom && j >= 4 && *( stcmd->name + j ) != '\0' && *( cmdname + j ) == '\0' ) ) break; @@ -892,9 +892,9 @@ static COMMANDS *TraSearch( char *cmdname, COMMANDS * sttraStart ) while( sttra != NULL ) { - for( j = 0; *( sttra->name + j ) == toupper( *( cmdname + j ) ) && + for( j = 0; *( sttra->name + j ) == HB_TOUPPER( *( cmdname + j ) ) && *( sttra->name + j ) != '\0' && ( ( sttra->com_or_xcom ) ? 1 : ( j < 4 || ISNAME( ( BYTE ) * ( cmdname + j + 1 ) ) ) ); j++ ) ; - if( *( sttra->name + j ) == toupper( *( cmdname + j ) ) + if( *( sttra->name + j ) == HB_TOUPPER( *( cmdname + j ) ) || ( !sttra->com_or_xcom && j >= 4 && *( sttra->name + j ) != '\0' && *( cmdname + j ) == '\0' ) ) break; sttra = sttra->last; @@ -1226,7 +1226,7 @@ static void ConvertPatterns( char *mpatt, int mlen, char *rpatt, int rlen ) i++; continue; } - + /* Drag match marker, determine it type */ explen = 0; ipos = i; @@ -1917,7 +1917,7 @@ static int CommandStuff( char *ptrmp, char *inputLine, char *ptro, int *lenres, /* Store start position of outermost optional in pattern */ strtopti = ptrmp; } - if( !s_numBrackets && strtopti && strtptri != ptri && + if( !s_numBrackets && strtopti && strtptri != ptri && ( ISNAME( ( BYTE ) * ptri ) || *ptri == '&' ) ) { /* Input stream starts with a word or macro -store the position @@ -2072,7 +2072,7 @@ static int CommandStuff( char *ptrmp, char *inputLine, char *ptro, int *lenres, { SkipOptional( &ptrmp ); } - else + else return -1; } } @@ -2175,11 +2175,11 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL HB_TRACE( HB_TR_DEBUG, ( "WorkMarkers(%p, %p, %s, %p)", ptrmp, ptri, ptro, lenres ) ); - + maxlenreal = HB_PP_STR_SIZE; if( s_expreal == NULL ) s_expreal = ( char * ) hb_xgrab( maxlenreal + 1 ); - + /* Copying a match pattern to 'exppatt' */ lenpatt = stroncpy( exppatt, *ptrmp, 4 ); *ptrmp += 4; @@ -2335,13 +2335,13 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL if( *ptr == '&' ) { /* rglab: Thu Sep 2 21:30:07 2004 - * Special Clipper undocumented restricted match marker: + * Special Clipper undocumented restricted match marker: * * Clipper accepts the macro variable only here. * eg. - * SET FILTER TO &var. + * SET FILTER TO &var. * SET FILTER TO &var.foo - * SET FILTER TO &(var) + * SET FILTER TO &(var) * * Notice that any expression that starts from the macro * variable is not valid for this marker @@ -2353,7 +2353,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL if( **ptri == '&' ) { char * ptrmacro = *ptri; /* save current position */ - + *ptri += 1; HB_SKIPTABSPACES( *ptri ); if( **ptri == '(' ) /* macro expression &( expr ) */ @@ -2388,7 +2388,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL { char * ptmp = *ptri + lenreal; HB_SKIPTABSPACES( ptmp ); - if( ! IsInStr( *ptmp, ":/+*-%^=<>[{.," ) || + if( ! IsInStr( *ptmp, ":/+*-%^=<>[{.," ) || (*ptmp && ptmp[0]=='+' && ptmp[1]=='+') || (*ptmp && ptmp[0]=='-' && ptmp[1]=='-') ) { @@ -2550,12 +2550,12 @@ static int getExpReal( char *expreal, char **ptri, BOOL prlist, int maxrez, BOOL prlist = TRUE; } State = ( **ptri == '\'' || **ptri == '\"' || **ptri == '[' ) ? STATE_EXPRES : STATE_ID; - + while( **ptri != '\0' && !rez && lens < maxrez ) { if( State == STATE_EXPRES || ( cLastChar && strchr( "({[.|,$!#=<>^%*/+-", cLastChar ) ) ) - /* Ron Pinkas added if on State 2001-05-02 to avoid - multiple strings concatination. + /* Ron Pinkas added if on State 2001-05-02 to avoid + multiple strings concatination. */ { if( **ptri == '"' ) @@ -2643,8 +2643,8 @@ static int getExpReal( char *expreal, char **ptri, BOOL prlist, int maxrez, BOOL continue; } else if( **ptri == '[' ) - /* ( see below 5-2-2001 - && ( State == STATE_EXPRES || ( strchr( ")]}.", cLastChar ) == NULL + /* ( see below 5-2-2001 + && ( State == STATE_EXPRES || ( strchr( ")]}.", cLastChar ) == NULL && ! ISNAME( ( BYTE ) cLastChar ) ) ) */ { @@ -2702,8 +2702,8 @@ static int getExpReal( char *expreal, char **ptri, BOOL prlist, int maxrez, BOOL State = ( StBr1 == 0 && StBr2 == 0 && StBr3 == 0 ) ? STATE_ID_END : STATE_BRACKET; continue; } - /* Added by Ron Pinkas 2001-05-02 - ( removed lots of related scattered logic below! + /* Added by Ron Pinkas 2001-05-02 + ( removed lots of related scattered logic below! */ } else if( strchr( "'\"", **ptri ) ) @@ -3281,7 +3281,7 @@ static void SearnRep( char *exppatt, char *expreal, int lenreal, char *ptro, int if( s_expcopy == NULL ) s_expcopy = ( char * ) hb_xgrab( HB_PP_STR_SIZE ); - + if( *( exppatt + 1 ) == '\0' ) *( ptro + *lenres ) = '\0'; @@ -3387,7 +3387,7 @@ static void SearnRep( char *exppatt, char *expreal, int lenreal, char *ptro, int ptrOut = ptrOut + ifou; continue; } - + *lenres += ReplacePattern( exppatt[2], expreal, lenreal, ptrOut + ifou - 1, *lenres - ifou + 1 ); ptrOut = ptrOut + ifou; } @@ -3438,7 +3438,7 @@ static BOOL ScanMacro( char *expreal, int lenitem, int *pNewLen ) *pNewLen = lenitem - 1; return TRUE; } - else if( isalpha( ( BYTE ) expreal[i] ) || expreal[i] == '_' ) + else if( HB_ISALPHA( ( BYTE ) expreal[i] ) || expreal[i] == '_' ) { i++; while( ISNAME( ( BYTE ) expreal[i] ) ) @@ -3624,7 +3624,7 @@ static int ReplacePattern( char patttype, char *expreal, int lenreal, char *ptro if( *expreal != '\0' ) { int i; - + i = ( ifou ) ? 6 : 5; hb_pp_Stuff( "{|| },", ptro, i, 0, lenres ); hb_pp_Stuff( expreal, ptro + 4, lenitem, 0, lenres + i ); @@ -4052,25 +4052,25 @@ static int md_strAt( char *szSub, int lSubLen, char *szText, BOOL checkword, BOO } else if( szText[lPos] == '.' && szSub[0] != '.' ) { - if( toupper( szText[lPos + 1] ) == 'T' && szText[lPos + 2] == '.' ) + if( HB_TOUPPER( szText[lPos + 1] ) == 'T' && szText[lPos + 2] == '.' ) { lPos += 3; } - else if( toupper( szText[lPos + 1] ) == 'F' && szText[lPos + 2] == '.' ) + else if( HB_TOUPPER( szText[lPos + 1] ) == 'F' && szText[lPos + 2] == '.' ) { lPos += 3; } - else if( toupper( szText[lPos + 1] ) == 'O' && toupper( szText[lPos + 2] ) == 'R' && szText[lPos + 4] == '.' ) + else if( HB_TOUPPER( szText[lPos + 1] ) == 'O' && HB_TOUPPER( szText[lPos + 2] ) == 'R' && szText[lPos + 4] == '.' ) { lPos += 4; } - else if( toupper( szText[lPos + 1] ) == 'A' - && toupper( szText[lPos + 2] ) == 'N' && toupper( szText[lPos + 3] ) == 'D' && szText[lPos + 4] == '.' ) + else if( HB_TOUPPER( szText[lPos + 1] ) == 'A' + && HB_TOUPPER( szText[lPos + 2] ) == 'N' && HB_TOUPPER( szText[lPos + 3] ) == 'D' && szText[lPos + 4] == '.' ) { lPos += 5; } - else if( toupper( szText[lPos + 1] ) == 'N' - && toupper( szText[lPos + 2] ) == 'O' && toupper( szText[lPos + 3] ) == 'T' && szText[lPos + 4] == '.' ) + else if( HB_TOUPPER( szText[lPos + 1] ) == 'N' + && HB_TOUPPER( szText[lPos + 2] ) == 'O' && HB_TOUPPER( szText[lPos + 3] ) == 'T' && szText[lPos + 4] == '.' ) { lPos += 5; } @@ -4104,7 +4104,7 @@ static int md_strAt( char *szSub, int lSubLen, char *szText, BOOL checkword, BOO } if( ( lCase - && toupper( *( szText + lPos ) ) == toupper( *( szSub + lSubPos ) ) ) || ( !lCase && *( szText + lPos ) == *( szSub + lSubPos ) ) ) + && HB_TOUPPER( *( szText + lPos ) ) == HB_TOUPPER( *( szSub + lSubPos ) ) ) || ( !lCase && *( szText + lPos ) == *( szSub + lSubPos ) ) ) { lSubPos++; cLastChar = *( szText + lPos ); @@ -4243,20 +4243,20 @@ static int stroncpy( char *ptro, char *ptri, int lens ) static BOOL truncmp( char **ptro, char **ptri, BOOL lTrunc ) { char *ptrb = *ptro, co, ci; - + HB_TRACE( HB_TR_DEBUG, ( "truncmp(%p, %p, %d)", ptro, ptri, lTrunc ) ); - + for( ; **ptri != ' ' && **ptri != '\t' && **ptri != ',' && **ptri != HB_PP_OPT_START && **ptri != HB_PP_OPT_END - && **ptri != HB_PP_MATCH_MARK && **ptri != '\0' && toupper( **ptri ) == toupper( **ptro ); ( *ptro )++, ( *ptri )++ ) ; + && **ptri != HB_PP_MATCH_MARK && **ptri != '\0' && HB_TOUPPER( **ptri ) == HB_TOUPPER( **ptro ); ( *ptro )++, ( *ptri )++ ) ; co = *( *ptro - 1 ); ci = **ptri; - + if( ( ( ci == ' ' || ci == ',' || ci == HB_PP_OPT_START || ci == HB_PP_OPT_END || ci == HB_PP_MATCH_MARK || ci == '\0' ) && - ( ( !ISNAME( ( BYTE ) ** ptro ) && ISNAME( ( BYTE ) co ) ) || + ( ( !ISNAME( ( BYTE ) ** ptro ) && ISNAME( ( BYTE ) co ) ) || ( !ISNAME( ( BYTE ) co ) ) ) ) ) return FALSE; else if( lTrunc && *ptro - ptrb >= 4 && ISNAME( ( BYTE ) ci ) && !ISNAME( ( BYTE ) ** ptro ) && ISNAME( ( BYTE ) co ) ) @@ -4276,7 +4276,7 @@ static BOOL strincmp( char *ptro, char **ptri, BOOL lTrunc ) for( ; **ptri != ',' && **ptri != HB_PP_OPT_START && **ptri != HB_PP_OPT_END - && **ptri != HB_PP_MATCH_MARK && **ptri != '\0' && toupper( **ptri ) == toupper( *ptro ); ptro++, ( *ptri )++ ) ; + && **ptri != HB_PP_MATCH_MARK && **ptri != '\0' && HB_TOUPPER( **ptri ) == HB_TOUPPER( *ptro ); ptro++, ( *ptri )++ ) ; co = *( ptro - 1 ); ci = **ptri; if( ( ( ci == ' ' || ci == ',' || ci == HB_PP_OPT_START || @@ -4384,7 +4384,7 @@ static int NextWord( char **sSource, char *sDest, BOOL lLower ) while( **sSource != '\0' && **sSource != ' ' && **sSource != '\t' && **sSource != '(' ) { - *sDest++ = ( lLower ) ? tolower( **sSource ) : **sSource; + *sDest++ = ( lLower ) ? HB_TOLOWER( **sSource ) : **sSource; ( *sSource )++; i++; } @@ -4468,34 +4468,34 @@ static int NextName( char **sSource, char *sDest ) State = STATE_NORMAL; } /* Ron Pinkas added 2001-02-21 */ - else if( ( *sSource )[0] == '.' && toupper( ( *sSource )[1] ) == 'A' - && toupper( ( *sSource )[2] ) == 'N' && toupper( ( *sSource )[3] ) == 'D' && ( *sSource )[4] == '.' ) + else if( ( *sSource )[0] == '.' && HB_TOUPPER( ( *sSource )[1] ) == 'A' + && HB_TOUPPER( ( *sSource )[2] ) == 'N' && HB_TOUPPER( ( *sSource )[3] ) == 'D' && ( *sSource )[4] == '.' ) { ( *sSource ) += 5; cLastChar = ' '; continue; } - else if( ( *sSource )[0] == '.' && toupper( ( *sSource )[1] ) == 'N' - && toupper( ( *sSource )[2] ) == 'O' && toupper( ( *sSource )[3] ) == 'T' && ( *sSource )[4] == '.' ) + else if( ( *sSource )[0] == '.' && HB_TOUPPER( ( *sSource )[1] ) == 'N' + && HB_TOUPPER( ( *sSource )[2] ) == 'O' && HB_TOUPPER( ( *sSource )[3] ) == 'T' && ( *sSource )[4] == '.' ) { ( *sSource ) += 5; cLastChar = ' '; continue; } - else if( ( *sSource )[0] == '.' && toupper( ( *sSource )[1] ) == 'O' && toupper( ( *sSource )[2] ) == 'R' && ( *sSource )[3] == '.' ) + else if( ( *sSource )[0] == '.' && HB_TOUPPER( ( *sSource )[1] ) == 'O' && HB_TOUPPER( ( *sSource )[2] ) == 'R' && ( *sSource )[3] == '.' ) { ( *sSource ) += 4; cLastChar = ' '; continue; } /* End - Ron Pinkas added 2001-02-21 */ - else if( ( *sSource )[0] == '.' && toupper( ( *sSource )[1] ) == 'T' && ( *sSource )[2] == '.' ) + else if( ( *sSource )[0] == '.' && HB_TOUPPER( ( *sSource )[1] ) == 'T' && ( *sSource )[2] == '.' ) { ( *sSource ) += 3; cLastChar = ' '; continue; } - else if( ( *sSource )[0] == '.' && toupper( ( *sSource )[1] ) == 'F' && ( *sSource )[2] == '.' ) + else if( ( *sSource )[0] == '.' && HB_TOUPPER( ( *sSource )[1] ) == 'F' && ( *sSource )[2] == '.' ) { ( *sSource ) += 3; cLastChar = ' '; @@ -4668,7 +4668,7 @@ static int NextParm( char **sSource, char *sDest ) static BOOL IsIdentifier( char *szProspect ) { - if( isalpha( ( BYTE ) szProspect[0] ) || szProspect[0] == '_' ) + if( HB_ISALPHA( ( BYTE ) szProspect[0] ) || szProspect[0] == '_' ) { int i = 1; @@ -4692,15 +4692,15 @@ static int IsMacroVar( char *szText, BOOL isCommand ) { int len = 0; - if( isalpha( ( BYTE ) szText[0] ) || szText[0] == '_' ) + if( HB_ISALPHA( ( BYTE ) szText[0] ) || szText[0] == '_' ) { int i = 1; - while( ISNAME( ( BYTE ) szText[i] ) || isdigit( ( BYTE ) szText[i] ) || szText[i] == '&' || szText[i] == '.' ) + while( ISNAME( ( BYTE ) szText[i] ) || HB_ISDIGIT( ( BYTE ) szText[i] ) || szText[i] == '&' || szText[i] == '.' ) { i++; } -/* +/* while( ISNAME( ( BYTE ) szText[i] ) || szText[i] == '&' ) { i++; @@ -4708,7 +4708,7 @@ static int IsMacroVar( char *szText, BOOL isCommand ) if( szText[i] == '.' || szText[i] == '&' ) { i++; - while( ISNAME(( BYTE ) szText[i]) || isdigit( ( BYTE ) szText[i] ) || szText[i] == '&' || szText[i] == '.' ) + while( ISNAME(( BYTE ) szText[i]) || HB_ISDIGIT( ( BYTE ) szText[i] ) || szText[i] == '&' || szText[i] == '.' ) { i++; } diff --git a/harbour/contrib/hbct/ascpos.c b/harbour/contrib/hbct/ascpos.c index f874ce2b87..16f5609196 100644 --- a/harbour/contrib/hbct/ascpos.c +++ b/harbour/contrib/hbct/ascpos.c @@ -3,7 +3,7 @@ */ /* - * Harbour Project source code: + * Harbour Project source code: * CT3 string function * - ASCPOS * - VALPOS @@ -55,7 +55,6 @@ */ -#include #include "ct.h" @@ -85,7 +84,7 @@ static void do_ascpos( int iSwitch ) { if( iSwitch == DO_ASCPOS_VALPOS ) { - if( isdigit( ( size_t ) pcString[sPos - 1] ) ) + if( HB_ISDIGIT( ( size_t ) pcString[sPos - 1] ) ) hb_retnl( pcString[sPos - 1] - 48 ); else hb_retni( 0 ); diff --git a/harbour/contrib/hbct/pos1.c b/harbour/contrib/hbct/pos1.c index 8f06d4cc6c..136bde0e97 100644 --- a/harbour/contrib/hbct/pos1.c +++ b/harbour/contrib/hbct/pos1.c @@ -55,20 +55,18 @@ * */ - #include "ct.h" -#include #ifndef HB_CDP_SUPPORT_OFF # include "hbapicdp.h" -# define ISUPPER(c) ( isupper( ( UCHAR ) c ) || ( cdp->nChars && strchr( cdp->CharsUpper, ( UCHAR ) c ) != NULL ) ) -# define ISLOWER(c) ( islower( ( UCHAR ) c ) || ( cdp->nChars && strchr( cdp->CharsLower, ( UCHAR ) c ) != NULL ) ) -# define ISALPHA(c) ( isalpha( ( UCHAR ) c ) || ( cdp->nChars && ( strchr( cdp->CharsUpper, ( UCHAR ) c ) != NULL || strchr( cdp->CharsLower, c ) != NULL ) ) ) +# define ISUPPER(c) ( HB_ISUPPER( ( UCHAR ) c ) || ( cdp->nChars && strchr( cdp->CharsUpper, ( UCHAR ) c ) != NULL ) ) +# define ISLOWER(c) ( HB_ISLOWER( ( UCHAR ) c ) || ( cdp->nChars && strchr( cdp->CharsLower, ( UCHAR ) c ) != NULL ) ) +# define ISALPHA(c) ( HB_ISALPHA( ( UCHAR ) c ) || ( cdp->nChars && ( strchr( cdp->CharsUpper, ( UCHAR ) c ) != NULL || strchr( cdp->CharsLower, c ) != NULL ) ) ) # define HB_CDP_STUB PHB_CODEPAGE cdp = hb_vmCDP(); #else -# define ISUPPER(c) isupper( ( UCHAR ) c ) -# define ISLOWER(c) islower( ( UCHAR ) c ) -# define ISALPHA(c) isalpha( ( UCHAR ) c ) +# define ISUPPER(c) HB_ISUPPER( ( UCHAR ) c ) +# define ISLOWER(c) HB_ISLOWER( ( UCHAR ) c ) +# define ISALPHA(c) HB_ISALPHA( ( UCHAR ) c ) # define HB_CDP_STUB #endif diff --git a/harbour/contrib/hbtip/utils.c b/harbour/contrib/hbtip/utils.c index d3bd18854f..28a9629276 100644 --- a/harbour/contrib/hbtip/utils.c +++ b/harbour/contrib/hbtip/utils.c @@ -51,7 +51,17 @@ * */ -#include +/* + * The following parts are Copyright of the individual authors. + * www - http://www.harbour-project.org + * + * Copyright 1999-2001 Viktor Szakats + * hb_strAtI() + * + * See doc/license.txt for licensing terms. + * + */ + #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" @@ -401,7 +411,7 @@ static EXT_MIME_ENTRY s_extMimeTable[EXT_MIME_TABLE_SIZE] = /* Java */ /* 15*/ { "class", "application/java", 0 }, /* case sensitive! */ - /* 16*/ { "java", "text/java", 0 }, + /* 16*/ { "java", "text/java", 0 }, /* RTF file */ /* 17*/ { "rtf", "application/rtf", MIME_FLAG_CASEINSENS }, @@ -764,7 +774,7 @@ static ULONG hb_strAtI( const char * szSub, ULONG ulSubLen, const char * szText, while( ulPos < ulLen && ulSubPos < ulSubLen ) { - if( tolower( (BYTE) szText[ ulPos ] ) == tolower( (BYTE) szSub[ ulSubPos ] ) ) + if( HB_TOLOWER( (BYTE) szText[ ulPos ] ) == HB_TOLOWER( (BYTE) szSub[ ulSubPos ] ) ) { ulSubPos++; ulPos++; @@ -860,7 +870,7 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) char *cRet; int nPos = 0, nPosRet = 0; BYTE cElem; - + if ( ! cData ) { hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 1, hb_paramError(1) ); @@ -888,21 +898,21 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = 'p'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '<' ) + else if ( cElem == '<' ) { - cRet[ nPosRet++ ] = '&'; + cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = 'l'; cRet[ nPosRet++ ] = 't'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '>' ) + else if ( cElem == '>' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = 'g'; cRet[ nPosRet++ ] = 't'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '"' ) + else if ( cElem == '"' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = 'q'; @@ -911,7 +921,7 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = 't'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '\'' ) + else if ( cElem == '\'' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = '#'; @@ -920,7 +930,7 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = '9'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '\r' ) + else if ( cElem == '\r' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = '#'; @@ -928,8 +938,8 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = '1'; cRet[ nPosRet++ ] = '3'; cRet[ nPosRet++ ] = ';'; - } - else if ( cElem == '\n' ) + } + else if ( cElem == '\n' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = '#'; @@ -938,7 +948,7 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = '0'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem >= ' ' ) + else if ( cElem >= ' ' ) { cRet[ nPosRet ] = cElem; nPosRet++; diff --git a/harbour/contrib/xhb/hbxml.c b/harbour/contrib/xhb/hbxml.c index cb8dfc3ee8..fc70afd1f8 100644 --- a/harbour/contrib/xhb/hbxml.c +++ b/harbour/contrib/xhb/hbxml.c @@ -68,9 +68,7 @@ * Giancarlo Niccolai */ - #include -#include #include "hbapi.h" #include "hbapierr.h" @@ -237,7 +235,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL *ref, PHB_ITEM pDoc, PHB_ITEM return MXML_STATUS_DONE; default: - if ( isalpha( chr ) ) + if ( HB_ISALPHA( chr ) ) { if ( mxml_sgs_append_char( buf_name, ( char ) chr ) != MXML_STATUS_OK ) { @@ -256,7 +254,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL *ref, PHB_ITEM pDoc, PHB_ITEM /* scanning for a name */ case 1: - if ( isalnum( chr ) || chr == '_' || chr == '-' || chr == ':' ) + if ( HB_ISALNUM( chr ) || chr == '_' || chr == '-' || chr == ':' ) { if ( mxml_sgs_append_char( buf_name, ( char ) chr ) != MXML_STATUS_OK ) { @@ -384,7 +382,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL *ref, PHB_ITEM pDoc, PHB_ITEM buf_attrib->length = iPosAmper; mxml_sgs_append_char( buf_attrib, ( char ) chr ); } - else if ( ! isalpha( chr ) ) + else if ( ! HB_ISALPHA( chr ) ) { /* error - we have something like & & */ hbxml_set_doc_status( ref, pDoc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_WRONGENTITY ); @@ -892,7 +890,7 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL *ref, PHB_ITEM pNode, PHB_ITE switch ( iStatus ) { case 0: - if ( isalpha( chr ) ) { + if ( HB_ISALPHA( chr ) ) { /* can't cause reallocations */ buf[ iPos++ ] = ( char ) chr; iStatus = 1; @@ -906,7 +904,7 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL *ref, PHB_ITEM pNode, PHB_ITE break; case 1: - if ( isalnum( chr ) || chr == '_' || chr == '-' || chr == ':' ) + if ( HB_ISALNUM( chr ) || chr == '_' || chr == '-' || chr == ':' ) { /* can't cause reallocations */ buf[ iPos++ ] = ( char ) chr; @@ -1498,7 +1496,7 @@ static MXML_STATUS mxml_node_read( MXML_REFIL *ref, PHB_ITEM pNode,PHB_ITEM doc, node = mxml_node_new( doc ); mxml_node_read_pi( ref, node, doc ); } - else if ( isalpha( chr ) ) + else if ( HB_ISALPHA( chr ) ) { mxml_refil_ungetc( ref, chr ); node = mxml_node_new( doc ); @@ -1516,7 +1514,7 @@ static MXML_STATUS mxml_node_read( MXML_REFIL *ref, PHB_ITEM pNode,PHB_ITEM doc, { iStatus = 3; } - else if ( isalpha( chr ) ) + else if ( HB_ISALPHA( chr ) ) { node = mxml_node_new( doc ); mxml_refil_ungetc( ref, chr ); diff --git a/harbour/include/hbapicdp.h b/harbour/include/hbapicdp.h index 572c240dd0..248b000665 100644 --- a/harbour/include/hbapicdp.h +++ b/harbour/include/hbapicdp.h @@ -53,8 +53,6 @@ #ifndef HB_APICDP_H_ #define HB_APICDP_H_ -#include - #ifndef HB_CDP_SUPPORT_OFF #include "hbapi.h" @@ -188,13 +186,13 @@ typedef struct _HB_CODEPAGE #define HB_UNITB_8859_1 &hb_uniTbl_8859_1 #define HB_UNITB_8859_1B &hb_uniTbl_8859_1b #define HB_UNITB_8859_2 &hb_uniTbl_8859_2 -#define HB_UNITB_8859_3 &hb_uniTbl_8859_3 -#define HB_UNITB_8859_4 &hb_uniTbl_8859_4 +#define HB_UNITB_8859_3 &hb_uniTbl_8859_3 +#define HB_UNITB_8859_4 &hb_uniTbl_8859_4 #define HB_UNITB_8859_5 &hb_uniTbl_8859_5 -#define HB_UNITB_8859_6 &hb_uniTbl_8859_6 -#define HB_UNITB_8859_7 &hb_uniTbl_8859_7 -#define HB_UNITB_8859_8 &hb_uniTbl_8859_8 -#define HB_UNITB_8859_9 &hb_uniTbl_8859_9 +#define HB_UNITB_8859_6 &hb_uniTbl_8859_6 +#define HB_UNITB_8859_7 &hb_uniTbl_8859_7 +#define HB_UNITB_8859_8 &hb_uniTbl_8859_8 +#define HB_UNITB_8859_9 &hb_uniTbl_8859_9 #define HB_UNITB_8859_10 &hb_uniTbl_8859_10 #define HB_UNITB_8859_11 &hb_uniTbl_8859_11 #define HB_UNITB_8859_13 &hb_uniTbl_8859_13 diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 2f7f071406..f6860d9a52 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -1167,6 +1167,7 @@ typedef unsigned long HB_COUNTER; #define HB_TOLOWER( c ) ( ( c ) >= 'A' && ( c ) <= 'Z' ? ( c ) + ( 'a' - 'A' ) : ( c ) ) #define HB_ISDIGIT( c ) ( ( c ) >= '0' && ( c ) <= '9' ) #define HB_ISALPHA( c ) ( HB_ISUPPER( c ) || HB_ISLOWER( c ) ) +#define HB_ISALNUM( c ) ( HB_ISALPHA( c ) || HB_ISDIGIT( c ) ) #if defined( __POCC__ ) || defined( __XCC__ ) #define HB_SYMBOL_UNUSED( symbol ) do if( symbol ) {;} while( 0 ) diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index d80724ad04..801df8da66 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -439,8 +439,8 @@ HB_PP_TOKEN, * PHB_PP_TOKEN; #endif #define HB_PP_ISTEXTCHAR(c) ( (unsigned char) (c) >= 128 ) #define HB_PP_ISBLANK(c) ( (c) == ' ' || (c) == '\t' ) -#define HB_PP_ISDIGIT(c) ( (c) >= '0' && (c) <= '9' ) -#define HB_PP_ISHEX(c) ( HB_PP_ISDIGIT(c) || \ +#define HB_PP_ISDIGIT(c) HB_ISDIGIT( c ) +#define HB_PP_ISHEX(c) ( HB_ISDIGIT(c) || \ ( (c) >= 'A' && (c) <= 'F' ) || \ ( (c) >= 'a' && (c) <= 'f' ) ) #define HB_PP_ISTRUE(c) ( (c) == 'T' || (c) == 't' || \ @@ -449,9 +449,9 @@ HB_PP_TOKEN, * PHB_PP_TOKEN; (c) == 'N' || (c) == 'n' ) #define HB_PP_ISFIRSTIDCHAR(c) ( ( (c) >= 'A' && (c) <= 'Z' ) || \ ( (c) >= 'a' && (c) <= 'z' ) || (c) == '_' ) -#define HB_PP_ISNEXTIDCHAR(c) ( HB_PP_ISFIRSTIDCHAR(c) || HB_PP_ISDIGIT(c) ) -#define HB_PP_UPPER(c) ( (c) >= 'a' && (c) <= 'z' ? \ - (c) - ( 'a' - 'A' ) : (c) ) +#define HB_PP_ISNEXTIDCHAR(c) ( HB_PP_ISFIRSTIDCHAR(c) || HB_ISDIGIT(c) ) +#define HB_PP_UPPER(c) HB_TOUPPER( c ) + typedef struct _HB_PP_RESULT { struct _HB_PP_RESULT * pNext; diff --git a/harbour/source/common/expropt2.c b/harbour/source/common/expropt2.c index f8b87e7c43..e2f7afd151 100644 --- a/harbour/source/common/expropt2.c +++ b/harbour/source/common/expropt2.c @@ -1366,7 +1366,7 @@ HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_COMP_DECL ) } case HB_ET_STRING: - /* NOTE: when not exact comparison (==) is used + /* NOTE: when not exact comparison (==) is used * the result depends on SET EXACT setting then it * cannot be optimized except the case when NULL string are * compared - "" = "" is always TRUE regardless of EXACT @@ -2048,7 +2048,7 @@ BOOL hb_compExprReduceUPPER( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { if( pArg->ulLength == 1 ) { - szValue = ( char * ) hb_szAscii[ toupper( ( unsigned char ) + szValue = ( char * ) hb_szAscii[ HB_TOUPPER( ( unsigned char ) pArg->value.asString.string[ 0 ] ) ]; fDealloc = FALSE; } @@ -2067,7 +2067,7 @@ BOOL hb_compExprReduceUPPER( HB_EXPR_PTR pSelf, HB_COMP_DECL ) fDealloc = TRUE; } do - szValue[ ulLen ] = ( char ) toupper( ( unsigned char ) szValue[ ulLen ] ); + szValue[ ulLen ] = ( char ) HB_TOUPPER( ( unsigned char ) szValue[ ulLen ] ); while( ++ulLen < pArg->ulLength ); } } diff --git a/harbour/source/common/hbstr.c b/harbour/source/common/hbstr.c index 5dd7f9f653..dae2fdaa91 100644 --- a/harbour/source/common/hbstr.c +++ b/harbour/source/common/hbstr.c @@ -61,9 +61,6 @@ * */ - -#include /* Needed by hb_strupr() */ - #include "hbapi.h" #include "hbmath.h" @@ -139,7 +136,7 @@ char * hb_strupr( char * pszText ) HB_TRACE(HB_TR_DEBUG, ("hb_strupr(%s)", pszText)); for( pszPos = pszText; *pszPos; pszPos++ ) - *pszPos = ( char ) toupper( ( UCHAR ) *pszPos ); + *pszPos = ( char ) HB_TOUPPER( ( UCHAR ) *pszPos ); return pszText; } @@ -151,7 +148,7 @@ char * hb_strlow( char * pszText ) HB_TRACE(HB_TR_DEBUG, ("hb_strlow(%s)", pszText)); for( pszPos = pszText; *pszPos; pszPos++ ) - *pszPos = ( char ) tolower( ( UCHAR ) *pszPos ); + *pszPos = ( char ) HB_TOLOWER( ( UCHAR ) *pszPos ); return pszText; } @@ -247,8 +244,8 @@ int hb_stricmp( const char * s1, const char * s2 ) do { - c1 = toupper( ( unsigned char ) *s1 ); - c2 = toupper( ( unsigned char ) *s2 ); + c1 = HB_TOUPPER( ( unsigned char ) *s1 ); + c2 = HB_TOUPPER( ( unsigned char ) *s2 ); if( c1 != c2 ) { @@ -274,8 +271,8 @@ int hb_strnicmp( const char * s1, const char * s2, ULONG count ) for( ulCount = 0; ulCount < count; ulCount++ ) { - unsigned char c1 = ( char ) toupper( ( unsigned char ) s1[ ulCount ] ); - unsigned char c2 = ( char ) toupper( ( unsigned char ) s2[ ulCount ] ); + unsigned char c1 = ( char ) HB_TOUPPER( ( unsigned char ) s1[ ulCount ] ); + unsigned char c2 = ( char ) HB_TOUPPER( ( unsigned char ) s2[ ulCount ] ); if( c1 != c2 ) { @@ -859,9 +856,7 @@ char * hb_strncpyLower( char * pDest, const char * pSource, ULONG ulLen ) pDest[ ulLen ] ='\0'; - /* some compilers implement tolower as a macro, and this has side effects! */ - /* *pDest++ = tolower( *pSource++ ); */ - while( ulLen && ( *pDest++ = ( char ) tolower( ( UCHAR ) *pSource ) ) != '\0' ) + while( ulLen && ( *pDest++ = ( char ) HB_TOLOWER( ( UCHAR ) *pSource ) ) != '\0' ) { ulLen--; pSource++; @@ -888,9 +883,7 @@ char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLen ) pDest[ ulLen ] ='\0'; - /* some compilers implement toupper as a macro, and this has side effects! */ - /* *pDest++ = toupper( *pSource++ ); */ - while( ulLen && ( *pDest++ = ( char ) toupper( ( UCHAR ) *pSource ) ) != '\0' ) + while( ulLen && ( *pDest++ = ( char ) HB_TOUPPER( ( UCHAR ) *pSource ) ) != '\0' ) { ulLen--; pSource++; @@ -925,10 +918,8 @@ char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG ulLen ) pDest[ ulLen ] = '\0'; - /* some compilers impliment toupper as a macro, and this has side effects! */ - /* *pDest++ = toupper( *pSource++ ); */ while( ulLen && ulSLen && - ( *pDest++ = ( char ) toupper( ( UCHAR ) *pSource ) ) != '\0' ) + ( *pDest++ = ( char ) HB_TOUPPER( ( UCHAR ) *pSource ) ) != '\0' ) { ulSLen--; ulLen--; @@ -962,8 +953,6 @@ char * hb_strncpyTrim( char * pDest, const char * pSource, ULONG ulLen ) pDest[ ulLen ] ='\0'; - /* some compilers impliment toupper as a macro, and this has side effects! */ - /* *pDest++ = toupper( *pSource++ ); */ while( ulLen && ulSLen && ( *pDest++ = *pSource++ ) != '\0' ) { ulSLen--; diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 051c98740b..bd8f8f0c2c 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -140,7 +140,7 @@ static void hb_compDebugStart( void ) { }; struct { BOOL bMacro; - union + union { char * string; HB_EXPR_PTR macro; @@ -496,14 +496,14 @@ LineStat : Crlf { $$ = 0; } | ControlError { $$ = 0; hb_compCheckUnclosedStru( HB_COMP_PARAM, HB_COMP_PARAM->functions.pLast ); } | error { if( HB_COMP_PARAM->ilastLineErr && HB_COMP_PARAM->ilastLineErr == HB_COMP_PARAM->currLine ) { - yyclearin; + yyclearin; } else { yyerrok; HB_COMP_PARAM->ilastLineErr = HB_COMP_PARAM->currLine; } - $$ = 0; + $$ = 0; } ; @@ -1108,11 +1108,11 @@ IfInlineAlias : IfInline ALIASOP ; VarDefs : LOCAL { HB_COMP_PARAM->iVarScope = VS_LOCAL; hb_compLinePush( HB_COMP_PARAM ); } - VarList Crlf + VarList Crlf | STATIC { HB_COMP_PARAM->iVarScope = VS_STATIC; hb_compLinePush( HB_COMP_PARAM ); } - VarList Crlf + VarList Crlf | THREAD STATIC { HB_COMP_PARAM->iVarScope = VS_TH_STATIC; hb_compLinePush( HB_COMP_PARAM ); } - VarList Crlf + VarList Crlf | PARAMETERS { if( HB_COMP_PARAM->functions.pLast->bFlags & FUN_USES_LOCAL_PARAMS ) hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_PARAMETERS_NOT_ALLOWED, NULL, NULL ); else @@ -1238,13 +1238,13 @@ Declaration: DECLARE IdentName '(' { hb_compDeclaredAdd( HB_COMP_PARAM, $2 ); HB { HB_COMP_PARAM->pLastDeclared->cType = $7->cVarType; - if ( toupper( $7->cVarType ) == 'S' ) + if ( HB_TOUPPER( $7->cVarType ) == 'S' ) { HB_COMP_PARAM->pLastDeclared->pClass = hb_compClassFind( HB_COMP_PARAM, $7->szFromClass ); if( ! HB_COMP_PARAM->pLastDeclared->pClass ) { hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, $7->szFromClass, HB_COMP_PARAM->pLastDeclared->szName ); - HB_COMP_PARAM->pLastDeclared->cType = ( isupper( ( UCHAR ) $7->cVarType ) ? 'O' : 'o' ); + HB_COMP_PARAM->pLastDeclared->cType = ( HB_ISUPPER( ( UCHAR ) $7->cVarType ) ? 'O' : 'o' ); } } } @@ -1273,13 +1273,13 @@ DecMethod : IdentName '(' { HB_COMP_PARAM->pLastMethod = hb_compMethodAdd( HB_C if( HB_COMP_PARAM->pLastMethod ) { HB_COMP_PARAM->pLastMethod->cType = $6->cVarType; - if ( toupper( $6->cVarType ) == 'S' ) + if ( HB_TOUPPER( $6->cVarType ) == 'S' ) { HB_COMP_PARAM->pLastMethod->pClass = hb_compClassFind( HB_COMP_PARAM, $6->szFromClass ); if( ! HB_COMP_PARAM->pLastMethod->pClass ) { hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, $6->szFromClass, HB_COMP_PARAM->pLastMethod->szName ); - HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( UCHAR ) $6->cVarType ) ? 'O' : 'o' ); + HB_COMP_PARAM->pLastMethod->cType = ( HB_ISUPPER( ( UCHAR ) $6->cVarType ) ? 'O' : 'o' ); } } } @@ -1297,18 +1297,18 @@ DecData : IdentName { HB_COMP_PARAM->pLastMethod = hb_compMethodAdd( HB_COMP_ char cVarType = $3->cVarType; /* List Type overrides if exists. */ - if( HB_COMP_PARAM->cDataListType ) + if( HB_COMP_PARAM->cDataListType ) cVarType = HB_COMP_PARAM->cDataListType; HB_COMP_PARAM->pLastMethod->cType = cVarType; - if ( toupper( cVarType ) == 'S' ) + if ( HB_TOUPPER( cVarType ) == 'S' ) { pClass = hb_compClassFind( HB_COMP_PARAM, $3->szFromClass ); HB_COMP_PARAM->pLastMethod->pClass = pClass; if( ! HB_COMP_PARAM->pLastMethod->pClass ) { hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, $3->szFromClass, HB_COMP_PARAM->pLastMethod->szName ); - HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( UCHAR ) cVarType ) ? 'O' :'o' ); + HB_COMP_PARAM->pLastMethod->cType = ( HB_ISUPPER( ( UCHAR ) cVarType ) ? 'O' :'o' ); } } else @@ -1332,7 +1332,7 @@ DecData : IdentName { HB_COMP_PARAM->pLastMethod = hb_compMethodAdd( HB_COMP_ HB_COMP_PARAM->pLastMethod->cParamTypes[0] = cVarType; HB_COMP_PARAM->pLastMethod->pParamClasses[0] = pClass; - if ( toupper( cVarType ) == 'S' ) + if ( HB_TOUPPER( cVarType ) == 'S' ) { HB_COMP_PARAM->pLastMethod->pClass = pClass; } @@ -1423,7 +1423,7 @@ IfElseIf : ELSEIF { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE EndIf : EndIfID { if( HB_COMP_PARAM->functions.pLast->wIfCounter ) - --HB_COMP_PARAM->functions.pLast->wIfCounter; + --HB_COMP_PARAM->functions.pLast->wIfCounter; HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); } ; @@ -1515,7 +1515,7 @@ DoWhile : WhileBegin ExpList Crlf } EndWhile { - hb_compGenJumpHere( ( ULONG ) $4, HB_COMP_PARAM ); + hb_compGenJumpHere( ( ULONG ) $4, HB_COMP_PARAM ); if( HB_COMP_PARAM->functions.pLast->wWhileCounter ) --HB_COMP_PARAM->functions.pLast->wWhileCounter; hb_compLoopEnd( HB_COMP_PARAM ); @@ -1711,7 +1711,7 @@ DoSwitch : SwitchBegin EndSwitch : EndSwitchID { if( HB_COMP_PARAM->functions.pLast->wSwitchCounter ) - --HB_COMP_PARAM->functions.pLast->wSwitchCounter; + --HB_COMP_PARAM->functions.pLast->wSwitchCounter; HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); } ; @@ -1720,8 +1720,8 @@ EndSwitchID : ENDSWITCH | END ; -SwitchStart : DOSWITCH - { ++HB_COMP_PARAM->functions.pLast->wSwitchCounter; +SwitchStart : DOSWITCH + { ++HB_COMP_PARAM->functions.pLast->wSwitchCounter; hb_compLinePushIfInside( HB_COMP_PARAM ); } Expression Crlf @@ -2211,7 +2211,7 @@ void hb_compLoopKill( PFUNCTION pFunc ) { HB_LOOPEXIT_PTR pLoop, pFree; - while( pFunc->pLoops ) + while( pFunc->pLoops ) { pLoop = pFunc->pLoops; while( pLoop->pExitList ) @@ -2476,7 +2476,7 @@ BOOL hb_compForEachVarError( HB_COMP_DECL, const char *szVarName ) { if( pEnumVar->bForEach ) { - /* only if it is FOR EACH enumerator + /* only if it is FOR EACH enumerator * generate warning if it is FOR/NEXT loop */ return FALSE; diff --git a/harbour/source/compiler/harbour.yyc b/harbour/source/compiler/harbour.yyc index 5574abbda2..a6c6e803df 100644 --- a/harbour/source/compiler/harbour.yyc +++ b/harbour/source/compiler/harbour.yyc @@ -457,7 +457,7 @@ typedef union YYSTYPE struct { BOOL bMacro; - union + union { char * string; HB_EXPR_PTR macro; @@ -4778,14 +4778,14 @@ yyreduce: #line 497 "harbour.y" { if( HB_COMP_PARAM->ilastLineErr && HB_COMP_PARAM->ilastLineErr == HB_COMP_PARAM->currLine ) { - yyclearin; + yyclearin; } else { yyerrok; HB_COMP_PARAM->ilastLineErr = HB_COMP_PARAM->currLine; } - (yyval.lNumber) = 0; + (yyval.lNumber) = 0; ;} break; @@ -6122,13 +6122,13 @@ yyreduce: { HB_COMP_PARAM->pLastDeclared->cType = (yyvsp[(7) - (8)].asVarType)->cVarType; - if ( toupper( (yyvsp[(7) - (8)].asVarType)->cVarType ) == 'S' ) + if ( HB_TOUPPER( (yyvsp[(7) - (8)].asVarType)->cVarType ) == 'S' ) { HB_COMP_PARAM->pLastDeclared->pClass = hb_compClassFind( HB_COMP_PARAM, (yyvsp[(7) - (8)].asVarType)->szFromClass ); if( ! HB_COMP_PARAM->pLastDeclared->pClass ) { hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, (yyvsp[(7) - (8)].asVarType)->szFromClass, HB_COMP_PARAM->pLastDeclared->szName ); - HB_COMP_PARAM->pLastDeclared->cType = ( isupper( ( UCHAR ) (yyvsp[(7) - (8)].asVarType)->cVarType ) ? 'O' : 'o' ); + HB_COMP_PARAM->pLastDeclared->cType = ( HB_ISUPPER( ( UCHAR ) (yyvsp[(7) - (8)].asVarType)->cVarType ) ? 'O' : 'o' ); } } } @@ -6183,13 +6183,13 @@ yyreduce: if( HB_COMP_PARAM->pLastMethod ) { HB_COMP_PARAM->pLastMethod->cType = (yyvsp[(6) - (6)].asVarType)->cVarType; - if ( toupper( (yyvsp[(6) - (6)].asVarType)->cVarType ) == 'S' ) + if ( HB_TOUPPER( (yyvsp[(6) - (6)].asVarType)->cVarType ) == 'S' ) { HB_COMP_PARAM->pLastMethod->pClass = hb_compClassFind( HB_COMP_PARAM, (yyvsp[(6) - (6)].asVarType)->szFromClass ); if( ! HB_COMP_PARAM->pLastMethod->pClass ) { hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, (yyvsp[(6) - (6)].asVarType)->szFromClass, HB_COMP_PARAM->pLastMethod->szName ); - HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( UCHAR ) (yyvsp[(6) - (6)].asVarType)->cVarType ) ? 'O' : 'o' ); + HB_COMP_PARAM->pLastMethod->cType = ( HB_ISUPPER( ( UCHAR ) (yyvsp[(6) - (6)].asVarType)->cVarType ) ? 'O' : 'o' ); } } } @@ -6213,18 +6213,18 @@ yyreduce: char cVarType = (yyvsp[(3) - (3)].asVarType)->cVarType; /* List Type overrides if exists. */ - if( HB_COMP_PARAM->cDataListType ) + if( HB_COMP_PARAM->cDataListType ) cVarType = HB_COMP_PARAM->cDataListType; HB_COMP_PARAM->pLastMethod->cType = cVarType; - if ( toupper( cVarType ) == 'S' ) + if ( HB_TOUPPER( cVarType ) == 'S' ) { pClass = hb_compClassFind( HB_COMP_PARAM, (yyvsp[(3) - (3)].asVarType)->szFromClass ); HB_COMP_PARAM->pLastMethod->pClass = pClass; if( ! HB_COMP_PARAM->pLastMethod->pClass ) { hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, (yyvsp[(3) - (3)].asVarType)->szFromClass, HB_COMP_PARAM->pLastMethod->szName ); - HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( UCHAR ) cVarType ) ? 'O' :'o' ); + HB_COMP_PARAM->pLastMethod->cType = ( HB_ISUPPER( ( UCHAR ) cVarType ) ? 'O' :'o' ); } } else @@ -6248,7 +6248,7 @@ yyreduce: HB_COMP_PARAM->pLastMethod->cParamTypes[0] = cVarType; HB_COMP_PARAM->pLastMethod->pParamClasses[0] = pClass; - if ( toupper( cVarType ) == 'S' ) + if ( HB_TOUPPER( cVarType ) == 'S' ) { HB_COMP_PARAM->pLastMethod->pClass = pClass; } @@ -6405,7 +6405,7 @@ yyreduce: #line 1424 "harbour.y" { if( HB_COMP_PARAM->functions.pLast->wIfCounter ) - --HB_COMP_PARAM->functions.pLast->wIfCounter; + --HB_COMP_PARAM->functions.pLast->wIfCounter; HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); ;} break; @@ -6521,7 +6521,7 @@ yyreduce: case 544: #line 1517 "harbour.y" { - hb_compGenJumpHere( ( ULONG ) (yyvsp[(4) - (7)].lNumber), HB_COMP_PARAM ); + hb_compGenJumpHere( ( ULONG ) (yyvsp[(4) - (7)].lNumber), HB_COMP_PARAM ); if( HB_COMP_PARAM->functions.pLast->wWhileCounter ) --HB_COMP_PARAM->functions.pLast->wWhileCounter; hb_compLoopEnd( HB_COMP_PARAM ); @@ -6761,14 +6761,14 @@ yyreduce: #line 1712 "harbour.y" { if( HB_COMP_PARAM->functions.pLast->wSwitchCounter ) - --HB_COMP_PARAM->functions.pLast->wSwitchCounter; + --HB_COMP_PARAM->functions.pLast->wSwitchCounter; HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); ;} break; case 582: #line 1724 "harbour.y" - { ++HB_COMP_PARAM->functions.pLast->wSwitchCounter; + { ++HB_COMP_PARAM->functions.pLast->wSwitchCounter; hb_compLinePushIfInside( HB_COMP_PARAM ); ;} break; @@ -7522,7 +7522,7 @@ void hb_compLoopKill( PFUNCTION pFunc ) { HB_LOOPEXIT_PTR pLoop, pFree; - while( pFunc->pLoops ) + while( pFunc->pLoops ) { pLoop = pFunc->pLoops; while( pLoop->pExitList ) @@ -7787,7 +7787,7 @@ BOOL hb_compForEachVarError( HB_COMP_DECL, const char *szVarName ) { if( pEnumVar->bForEach ) { - /* only if it is FOR EACH enumerator + /* only if it is FOR EACH enumerator * generate warning if it is FOR/NEXT loop */ return FALSE; @@ -8136,4 +8136,3 @@ void yyerror( HB_COMP_DECL, const char * s ) else hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_YACC, s, HB_COMP_PARAM->pLex->lasttok ); } - diff --git a/harbour/source/compiler/hbmain.c b/harbour/source/compiler/hbmain.c index 9491c4a595..1b3caf83dd 100644 --- a/harbour/source/compiler/hbmain.c +++ b/harbour/source/compiler/hbmain.c @@ -464,7 +464,7 @@ void hb_compVariableAdd( HB_COMP_DECL, const char * szVarName, PHB_VARTYPE pVarT pVar->pNext = NULL; pVar->iDeclLine = HB_COMP_PARAM->currLine; - if( toupper( pVarType->cVarType ) == 'S' ) + if( HB_TOUPPER( pVarType->cVarType ) == 'S' ) { /* printf( "\nVariable %s is of Class: %s\n", szVarName, pVarType->szFromClass ); */ pVar->pClass = hb_compClassFind( HB_COMP_PARAM, pVarType->szFromClass ); @@ -1165,7 +1165,7 @@ void hb_compDeclaredParameterAdd( HB_COMP_DECL, const char * szVarName, PHB_VART pDeclared->cParamTypes[ pDeclared->iParamCount - 1 ] = pVarType->cVarType; - if( toupper( pVarType->cVarType ) == 'S' ) + if( HB_TOUPPER( pVarType->cVarType ) == 'S' ) { pDeclared->pParamClasses[ pDeclared->iParamCount - 1 ] = hb_compClassFind( HB_COMP_PARAM, pVarType->szFromClass ); } @@ -1190,7 +1190,7 @@ void hb_compDeclaredParameterAdd( HB_COMP_DECL, const char * szVarName, PHB_VART HB_COMP_PARAM->pLastMethod->cParamTypes[ HB_COMP_PARAM->pLastMethod->iParamCount - 1 ] = pVarType->cVarType; - if( toupper( pVarType->cVarType ) == 'S' ) + if( HB_TOUPPER( pVarType->cVarType ) == 'S' ) { HB_COMP_PARAM->pLastMethod->pParamClasses[ HB_COMP_PARAM->pLastMethod->iParamCount - 1 ] = hb_compClassFind( HB_COMP_PARAM, pVarType->szFromClass ); diff --git a/harbour/source/debug/dbgentry.c b/harbour/source/debug/dbgentry.c index cbc9d5b368..b3c498a6ff 100644 --- a/harbour/source/debug/dbgentry.c +++ b/harbour/source/debug/dbgentry.c @@ -993,8 +993,8 @@ static PHB_ITEM hb_dbgEvalMacro( char *szExpr, PHB_ITEM pItem ) } -#define IS_IDENT_START( c ) ( isalpha( (UCHAR) (c) ) || (c) == '_' ) -#define IS_IDENT_CHAR( c ) ( IS_IDENT_START( (c) ) || isdigit( (UCHAR) (c) ) ) +#define IS_IDENT_START( c ) ( HB_ISALPHA( (UCHAR) (c) ) || (c) == '_' ) +#define IS_IDENT_CHAR( c ) ( IS_IDENT_START( (c) ) || HB_ISDIGIT( (UCHAR) (c) ) ) static int hb_dbgEvalSubstituteVar( HB_WATCHPOINT *watch, char *szWord, int nStart, int nLen ) { diff --git a/harbour/source/rdd/workarea.c b/harbour/source/rdd/workarea.c index df7a372cdc..8a8e168214 100644 --- a/harbour/source/rdd/workarea.c +++ b/harbour/source/rdd/workarea.c @@ -56,8 +56,6 @@ * */ -#include - #include "hbapi.h" #include "hbapirdd.h" #include "hbapiitm.h" @@ -305,7 +303,7 @@ static HB_ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct ) #else pFieldInfo.uiFlags = 0; #endif - iData = toupper( hb_arrayGetCPtr( pFieldDesc, DBS_TYPE )[ 0 ] ); + iData = HB_TOUPPER( hb_arrayGetCPtr( pFieldDesc, DBS_TYPE )[ 0 ] ); switch( iData ) { case 'C': diff --git a/harbour/source/rtl/cdpapi.c b/harbour/source/rtl/cdpapi.c index 9cf5940c68..69fda11ed7 100644 --- a/harbour/source/rtl/cdpapi.c +++ b/harbour/source/rtl/cdpapi.c @@ -335,8 +335,8 @@ BOOL hb_cdpRegister( PHB_CODEPAGE cdpage ) for( i = 0; i < 256; i++ ) { - cdpage->s_upper[i] = ( char ) toupper( ( UCHAR ) i ); - cdpage->s_lower[i] = ( char ) tolower( ( UCHAR ) i ); + cdpage->s_upper[i] = ( char ) HB_TOUPPER( ( UCHAR ) i ); + cdpage->s_lower[i] = ( char ) HB_TOLOWER( ( UCHAR ) i ); } if( strpbrk( cdpage->CharsUpper, "~." ) != NULL ) { diff --git a/harbour/source/rtl/dates.c b/harbour/source/rtl/dates.c index b1cc3b641e..1bad594048 100644 --- a/harbour/source/rtl/dates.c +++ b/harbour/source/rtl/dates.c @@ -50,8 +50,6 @@ * */ -#include - #include "hbapi.h" #include "hbdate.h" #include "hbset.h" @@ -85,10 +83,10 @@ char * hb_dateFormat( const char * szDate, char * szFormattedDate, const char * while( format_count < size ) { - digit = toupper( ( UCHAR ) *szPtr ); + digit = HB_TOUPPER( ( UCHAR ) *szPtr ); szPtr++; digit_count = 1; - while( toupper( ( UCHAR ) *szPtr ) == digit && format_count < size ) + while( HB_TOUPPER( ( UCHAR ) *szPtr ) == digit && format_count < size ) { szPtr++; if( format_count + digit_count < size ) @@ -296,7 +294,7 @@ long hb_dateUnformat( const char * szDate, const char * szDateFormat ) for( count = 0; count < size; count++ ) { digit = szDate[ count ]; - if( isdigit( digit ) ) + if( HB_ISDIGIT( digit ) ) { /* Process the digit for the current date field */ if( d_pos == 1 ) diff --git a/harbour/source/rtl/hbffind.c b/harbour/source/rtl/hbffind.c index e339ce832a..09331f9851 100644 --- a/harbour/source/rtl/hbffind.c +++ b/harbour/source/rtl/hbffind.c @@ -68,8 +68,6 @@ /* ------------------------------------------------------------- */ -#include - #if defined(HB_OS_DOS) #if defined(__DJGPP__) || defined(__RSX32__) @@ -344,7 +342,7 @@ ULONG hb_fsAttrEncode( const char * szAttr ) HB_TRACE(HB_TR_DEBUG, ("hb_fsAttrEncode(%p)", szAttr)); - while( ( ch = ( char ) toupper( *pos ) ) != '\0' ) + while( ( ch = ( char ) HB_TOUPPER( *pos ) ) != '\0' ) { switch( ch ) { diff --git a/harbour/source/rtl/is.c b/harbour/source/rtl/is.c index d19c20a182..60ce524820 100644 --- a/harbour/source/rtl/is.c +++ b/harbour/source/rtl/is.c @@ -50,19 +50,17 @@ * */ -#include - #include "hbapi.h" #include "hbapicdp.h" BOOL hb_charIsDigit( int iChar ) { - return isdigit( ( unsigned char ) iChar ); + return HB_ISDIGIT( ( unsigned char ) iChar ); } BOOL hb_charIsAlpha( int iChar ) { - if( isalpha( ( unsigned char ) iChar ) ) + if( HB_ISALPHA( ( unsigned char ) iChar ) ) hb_retl( TRUE ); #ifndef HB_CDP_SUPPORT_OFF else @@ -80,7 +78,7 @@ BOOL hb_charIsAlpha( int iChar ) BOOL hb_charIsLower( int iChar ) { - if( isupper( ( unsigned char ) iChar ) ) + if( HB_ISLOWER( ( unsigned char ) iChar ) ) return TRUE; #ifndef HB_CDP_SUPPORT_OFF else @@ -97,7 +95,7 @@ BOOL hb_charIsLower( int iChar ) BOOL hb_charIsUpper( int iChar ) { - if( islower( ( unsigned char ) iChar ) ) + if( HB_ISUPPER( ( unsigned char ) iChar ) ) return TRUE; #ifndef HB_CDP_SUPPORT_OFF else @@ -120,7 +118,7 @@ HB_FUNC( ISALPHA ) if( szString ) { - if( isalpha( ( unsigned char ) *szString ) ) + if( HB_ISALPHA( ( unsigned char ) *szString ) ) hb_retl( TRUE ); else { @@ -145,7 +143,7 @@ HB_FUNC( ISDIGIT ) { char * szString = hb_parc( 1 ); - hb_retl( szString && isdigit( ( unsigned char ) *szString ) ); + hb_retl( szString && HB_ISDIGIT( ( unsigned char ) *szString ) ); } /* determines if first char of string is upper-case */ @@ -156,7 +154,7 @@ HB_FUNC( ISUPPER ) if( szString ) { - if( isupper( ( unsigned char ) *szString ) ) + if( HB_ISUPPER( ( unsigned char ) *szString ) ) hb_retl( TRUE ); else { @@ -182,7 +180,7 @@ HB_FUNC( ISLOWER ) if( szString ) { - if( islower( ( unsigned char ) *szString ) ) + if( HB_ISLOWER( ( unsigned char ) *szString ) ) hb_retl( TRUE ); else { diff --git a/harbour/source/rtl/natmsg.c b/harbour/source/rtl/natmsg.c index f16e38d2ad..0878fe911e 100644 --- a/harbour/source/rtl/natmsg.c +++ b/harbour/source/rtl/natmsg.c @@ -62,8 +62,6 @@ * */ -#include - #include "hbapi.h" #include "hbapiitm.h" #include "hbapilng.h" @@ -97,14 +95,14 @@ HB_FUNC( __NATISAFFIRM ) { PHB_ITEM pItem = hb_param( 1, HB_IT_STRING ); - hb_retl( pItem && hb_itemGetCLen( pItem ) >= 1 && toupper( hb_itemGetCPtr( pItem )[ 0 ] ) == ( ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_NATMSG + _LF_YN - 1 ) )[ 0 ] ); + hb_retl( pItem && hb_itemGetCLen( pItem ) >= 1 && hb_charUpper( hb_itemGetCPtr( pItem )[ 0 ] ) == ( ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_NATMSG + _LF_YN - 1 ) )[ 0 ] ); } HB_FUNC( __NATISNEGATIVE ) { PHB_ITEM pItem = hb_param( 1, HB_IT_STRING ); - hb_retl( pItem && hb_itemGetCLen( pItem ) >= 1 && toupper( hb_itemGetCPtr( pItem )[ 0 ] ) == ( ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_NATMSG + _LF_YN - 1 ) )[ 2 ] ); + hb_retl( pItem && hb_itemGetCLen( pItem ) >= 1 && hb_charUpper( hb_itemGetCPtr( pItem )[ 0 ] ) == ( ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_NATMSG + _LF_YN - 1 ) )[ 2 ] ); } HB_FUNC( __NATMSG ) diff --git a/harbour/source/rtl/soundex.c b/harbour/source/rtl/soundex.c index 1f2688a51e..36e72c04a0 100644 --- a/harbour/source/rtl/soundex.c +++ b/harbour/source/rtl/soundex.c @@ -85,7 +85,7 @@ HB_FUNC( SOUNDEX ) differently for accented and national characters. It's also faster this way. [vszakats] */ - /* Convert to uppercase: toupper() */ + /* Convert to uppercase: HB_TOUPPER() */ if( cChar >= 'a' && cChar <= 'z' ) cChar -= ( 'a' - 'A' ); @@ -110,4 +110,3 @@ HB_FUNC( SOUNDEX ) hb_retc( szResult ); } - diff --git a/harbour/source/rtl/strcase.c b/harbour/source/rtl/strcase.c index fc975a35fc..7b551a9062 100644 --- a/harbour/source/rtl/strcase.c +++ b/harbour/source/rtl/strcase.c @@ -50,8 +50,6 @@ * */ -#include - #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index ee27f2e391..4ff4c5556e 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -61,8 +61,6 @@ * */ -#include - #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" @@ -306,7 +304,7 @@ HB_FUNC( TRANSFORM ) default: szResult[ ulResultPos++ ] = *szPic; } -#endif +#endif } szPic++; @@ -554,7 +552,7 @@ HB_FUNC( TRANSFORM ) } else if( cPic == ',' && i && iCount < iWidth ) { - if( isdigit( ( UCHAR ) szResult[ i - 1 ] ) ) + if( HB_ISDIGIT( ( UCHAR ) szResult[ i - 1 ] ) ) szResult[ i ] = ( uiPicFlags & PF_EXCHANG ) ? '.' : ','; else { diff --git a/harbour/source/vm/classes.c b/harbour/source/vm/classes.c index b02bfb23e9..78bb4a8287 100644 --- a/harbour/source/vm/classes.c +++ b/harbour/source/vm/classes.c @@ -148,8 +148,6 @@ #include "hbthread.h" #include "hboo.ch" -#include /* For toupper() */ - /* DEBUG only*/ /* #include */ diff --git a/harbour/source/vm/itemapi.c b/harbour/source/vm/itemapi.c index 9570f6375f..aae7bbb299 100644 --- a/harbour/source/vm/itemapi.c +++ b/harbour/source/vm/itemapi.c @@ -1507,7 +1507,7 @@ void hb_itemCopyFromRef( PHB_ITEM pDest, PHB_ITEM pSource ) } /* - * copy (transfer) the value of item without increasing + * copy (transfer) the value of item without increasing * a reference counters, the pSource item is cleared */ void hb_itemMove( PHB_ITEM pDest, PHB_ITEM pSource ) @@ -1822,7 +1822,7 @@ PHB_ITEM hb_itemUnRefWrite( PHB_ITEM pItem, PHB_ITEM pSource ) return pItem; } -/* Unreference passed variable +/* Unreference passed variable * Do not unreference the last reference stored */ PHB_ITEM hb_itemUnRefRefer( PHB_ITEM pItem ) @@ -2059,8 +2059,8 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) { do { - int i1 = toupper( ( UCHAR ) *szFirst ); - int i2 = toupper( ( UCHAR ) *szSecond ); + int i1 = HB_TOUPPER( ( UCHAR ) *szFirst ); + int i2 = HB_TOUPPER( ( UCHAR ) *szSecond ); if( i1 != i2 ) { iRet = ( i1 < i2 ) ? -1 : 1; diff --git a/harbour/source/vm/memvars.c b/harbour/source/vm/memvars.c index 887d2e0d61..ea326ef3bf 100644 --- a/harbour/source/vm/memvars.c +++ b/harbour/source/vm/memvars.c @@ -63,8 +63,6 @@ * */ -#include /* for toupper() function */ - #include "hbvmopt.h" #include "hbapi.h" #include "hbapiitm.h" diff --git a/harbour/source/vm/set.c b/harbour/source/vm/set.c index fb86132cdc..a4733cf8a9 100644 --- a/harbour/source/vm/set.c +++ b/harbour/source/vm/set.c @@ -113,13 +113,13 @@ static BOOL set_logical( PHB_ITEM pItem, BOOL bDefault ) ULONG ulLen = hb_itemGetCLen( pItem ); if( ulLen >= 2 - && toupper( ( UCHAR ) szString[ 0 ] ) == 'O' - && toupper( ( UCHAR ) szString[ 1 ] ) == 'N' ) + && ( ( UCHAR ) szString[ 0 ] == 'O' || ( UCHAR ) szString[ 0 ] == 'o' ) + && ( ( UCHAR ) szString[ 1 ] == 'N' || ( UCHAR ) szString[ 1 ] == 'n' ) ) bLogical = TRUE; else if( ulLen >= 3 - && toupper( ( UCHAR ) szString[ 0 ] ) == 'O' - && toupper( ( UCHAR ) szString[ 1 ] ) == 'F' - && toupper( ( UCHAR ) szString[ 2 ] ) == 'F' ) + && ( ( UCHAR ) szString[ 0 ] == 'O' || ( UCHAR ) szString[ 0 ] == 'o' ) + && ( ( UCHAR ) szString[ 1 ] == 'F' || ( UCHAR ) szString[ 1 ] == 'f' ) + && ( ( UCHAR ) szString[ 2 ] == 'F' || ( UCHAR ) szString[ 2 ] == 'f' ) ) bLogical = FALSE; } @@ -383,7 +383,7 @@ BOOL hb_setSetCentury( BOOL new_century_setting ) size = strlen( szDateFormat ); for( count = 0; count < size; count++ ) { - digit = toupper( ( UCHAR ) szDateFormat[ count ] ); + digit = HB_TOUPPER( ( UCHAR ) szDateFormat[ count ] ); if( digit == 'Y' ) { if( y_start == -1 )