diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2a28e41374..bf1e0acbc9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,44 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-02-13 21:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/bin/hb-func.sh + * do not pass linking parameters to GCC/G++ when is used for + compilation only + + * harbour/contrib/rdd_ads/Makefile + * set -DWIN32 for W32 compilation + * harbour/contrib/rdd_ads/makefile.bc + * formatting + + * harbour/include/hbapi.h + * harbour/source/rtl/strcase.c + + added hb_charUpper() and hb_charLower() + + * harbour/include/hbapigt.h + * harbour/include/hbgtcore.h + * harbour/source/rtl/gtapi.c + * harbour/source/rtl/hbgtcore.c + + added support for ALERT() on GT level - C functions: hb_gtAlert()/ + hb_gt_Alert() + To replicate some details of Clipper and CT3 behavior ALERT() cannot + be implement only on upper level as .prg function + * harbour/source/rtl/gtfunc.c + + added .prg function HB_GTALLERT() + * harbour/source/rtl/alert.prg + * redirected ALERT() to HB_GTALLERT() + + * harbour/source/rtl/fstemp.c + * use the same case conversion as in low level hb_fs*() functions to + avoid possible problems with national characters + + * harbour/source/rtl/dates.c + * harbour/source/rtl/set.c + * harbour/source/rtl/strmatch.c + * harbour/source/rtl/transfrm.c + * use hb_charUpper() + * casting + 2007-02-12 16:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/rdd_ads/ads1.c * do not release FLOCK() after DBAPPEND() - only RLOCKs should be diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index fdc3142403..d255d799ae 100644 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -413,7 +413,19 @@ FOUTE="\${FOUTE%.[oc]}${hb_exesuf}" hb_cc() { - ${CCPREFIX}\${HB_CC} "\$@" \${CC_OPT} \${GCC_PATHS} \${HB_USRLPATH} \${HB_USRLIBS} + local LNK_OPT P n + + LNK_OPT="\${LN_OPT} \${HB_USRLPATH} \${HB_USRLIBS} \${HARBOUR_LIBS} \${SYSTEM_LIBS}" + P=( "\$@" ); n=0 + while [ \$n -lt \${#P[@]} ]; do + if [ "\${P[\$n]}" = "-c" ]; then + LNK_OPT="" + n=\${#P[@]} + fi + n=\$[\$n + 1] + done + + ${CCPREFIX}\${HB_CC} "\$@" \${CC_OPT} \${GCC_PATHS} \${LNK_OPT} } hb_cmp() @@ -438,7 +450,7 @@ hb_link() hb_lnk_request > \${_TMP_FILE_} LN_OPT="\${_TMP_FILE_} \${LN_OPT}" fi - hb_cc "\$@" \${LN_OPT} \${GCC_PATHS} \${HB_USRLPATH} \${HB_USRLIBS} \${HARBOUR_LIBS} \${SYSTEM_LIBS} -o "\${FOUTE}" + hb_cc "\$@" -o "\${FOUTE}" } hb_lnk_request() diff --git a/harbour/contrib/rdd_ads/Makefile b/harbour/contrib/rdd_ads/Makefile index c98e53909e..53bb4559e9 100644 --- a/harbour/contrib/rdd_ads/Makefile +++ b/harbour/contrib/rdd_ads/Makefile @@ -14,6 +14,9 @@ PRG_HEADERS=\ LIBNAME=rddads +ifeq ($(HB_ARCHITECTURE),w32) + C_USR += -DWIN32 +endif include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) diff --git a/harbour/contrib/rdd_ads/makefile.bc b/harbour/contrib/rdd_ads/makefile.bc index 7ed6531fcf..282bab8b85 100644 --- a/harbour/contrib/rdd_ads/makefile.bc +++ b/harbour/contrib/rdd_ads/makefile.bc @@ -25,4 +25,4 @@ $(OBJ_DIR)\adsmgmnt.obj : adsmgmnt.c tlib $(LIB_DIR)\rddads.lib -+$@,, .prg.c: - $(BIN_DIR)\harbour.exe $< -q0 -w -es2 -gc0 -n -i$(INCLUDE_DIR) -o$@ + $(BIN_DIR)\harbour.exe $< -q0 -w -es2 -gc0 -n -i$(INCLUDE_DIR) -o$@ diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 753587a028..3935c13849 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -696,6 +696,8 @@ extern HB_EXPORT ULONG hb_strAt( const char * szSub, ULONG ulSubLen, const ch extern HB_EXPORT char * hb_strUpper( char * szText, ULONG ulLen ); /* convert an existing string buffer to upper case */ extern HB_EXPORT char * hb_strUpperCopy( char * szText, ULONG ulLen ); extern HB_EXPORT char * hb_strLower( char * szText, ULONG ulLen ); /* convert an existing string buffer to lower case */ +extern HB_EXPORT int hb_charUpper( int iChar ); /* converts iChar to upper case */ +extern HB_EXPORT int hb_charLower( int iChar ); /* converts iChar to lower case */ extern HB_EXPORT char * hb_strncpy( char * pDest, const char * pSource, ULONG ulLen ); /* copy at most ulLen bytes from string buffer to another buffer and _always_ set 0 in destin buffer */ extern HB_EXPORT char * hb_strncat( char * pDest, const char * pSource, ULONG ulLen ); /* copy at most ulLen-strlen(pDest) bytes from string buffer to another buffer and _always_ set 0 in destin buffer */ extern HB_EXPORT char * hb_strncpyTrim( char * pDest, const char * pSource, ULONG ulLen ); diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index 050962885c..12eb1495c2 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -193,6 +193,7 @@ extern HB_EXPORT ERRCODE hb_gtOutErr( BYTE * pbyStr, ULONG ulLen ); extern HB_EXPORT ERRCODE hb_gtSetDispCP( char * pszTermCDP, char * pszHostCDP, BOOL fBox ); extern HB_EXPORT ERRCODE hb_gtSetKeyCP( char * pszTermCDP, char * pszHostCDP ); extern HB_EXPORT ERRCODE hb_gtInfo( int iType, PHB_GT_INFO pInfo ); +extern HB_EXPORT int hb_gtAlert( PHB_ITEM pMessage, PHB_ITEM pOptions, int iClrNorm, int iClrHigh, double dDelay ); extern HB_EXPORT int hb_gtSetFlag( int iType, int iNewValue ); extern HB_EXPORT int hb_gtGfxPrimitive( int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ); extern HB_EXPORT ERRCODE hb_gtGfxText( int iTop, int iLeft, char * szText, int iColor, int iSize, int iWidth ); diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index c0187f3d14..36a6a075ba 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -179,6 +179,7 @@ typedef struct void (* Tone) ( double, double ); void (* Bell) ( void ); BOOL (* Info) ( int, PHB_GT_INFO ); + int (* Alert) ( PHB_ITEM, PHB_ITEM, int, int, double ); BOOL (* SetFlag) ( int, int ); /* internationalization */ @@ -376,6 +377,7 @@ extern void hb_gt_OutErr( BYTE * pbyStr, ULONG ulLen ); extern BOOL hb_gt_SetDispCP( char * pszTermCDP, char * pszHostCDP, BOOL fBox ); extern BOOL hb_gt_SetKeyCP( char * pszTermCDP, char * pszHostCDP ); extern BOOL hb_gt_Info( int iType, PHB_GT_INFO pInfo ); +extern int hb_gt_Alert( PHB_ITEM pMessage, PHB_ITEM pOptions, int iClrNorm, int iClrHigh, double dDelay ); extern int hb_gt_SetFlag( int iType, int iNewValue ); extern int hb_gt_ReadKey( int iEventMask ); extern void hb_mouse_Init( void ); @@ -479,7 +481,8 @@ extern void hb_gt_WhoCares( void * pCargo ); #define HB_GTSUPER_SETDISPCP(t,h,b) (HB_GTSUPER)->SetDispCP(t,h,b) #define HB_GTSUPER_SETKEYCP(t,h) (HB_GTSUPER)->SetKeyCP(t,h) #define HB_GTSUPER_INFO(i,p) (HB_GTSUPER)->Info(i,p) -#define HB_GTSUPER_SETFLAG(i,f) (HB_GTSUPER)->Info(i,f) +#define HB_GTSUPER_ALERT(m,o,n,h,d) (HB_GTSUPER)->Alert(m,o,n,h,d) +#define HB_GTSUPER_SETFLAG(i,f) (HB_GTSUPER)->SetFlag(i,f) #define HB_GTSUPER_READKEY(m) (HB_GTSUPER)->ReadKey(m) #define HB_GTSUPER_MOUSEINIT() (HB_GTSUPER)->MouseInit() #define HB_GTSUPER_MOUSEEXIT() (HB_GTSUPER)->MouseExit() diff --git a/harbour/source/rtl/alert.prg b/harbour/source/rtl/alert.prg index 3b970753e3..750566e599 100644 --- a/harbour/source/rtl/alert.prg +++ b/harbour/source/rtl/alert.prg @@ -49,29 +49,10 @@ STATIC s_lNoAlert #endif FUNCTION Alert( xMessage, aOptions, cColorNorm, nDelay ) - LOCAL nChoice - LOCAL aSay - LOCAL nPos, nMaxWidth, nDefWidth, nWidth, nOpWidth, nInitRow, nInitCol, nEval - LOCAL nKey, cKey, aPos, nCurrent, aHotkey, aOptionsOK - LOCAL cColorHigh - - LOCAL nOldRow - LOCAL nOldCol - LOCAL nOldCursor - LOCAL cOldScreen - - LOCAL nOldDispCount - LOCAL nCount - Local cLine - -#ifdef HB_COMPAT_C53 - LOCAL nMRow, nMCol -#endif - - /* TOFIX: Clipper decides at runtime, whether the full screen GT is - linked. if it is not, the pure tty mode is choosen here. - [vszakats] */ - LOCAL lTTY := !hb_gtInfo( GTI_FULLSCREEN ) + LOCAL cMessage, cLine, cColorHigh + LOCAL aOptionsOK + LOCAL nEval + LOCAL lFirst #ifdef HB_C52_UNDOC @@ -83,45 +64,13 @@ FUNCTION Alert( xMessage, aOptions, cColorNorm, nDelay ) #endif - aSay := {} - - nMaxWidth := MaxCol() - 3 - nDefWidth := Int( nMaxWidth / 4 * 3 ) - #ifdef HB_C52_STRICT IF !ISCHARACTER( xMessage ) RETURN NIL ENDIF - DO WHILE Len( xMessage ) != 0 - nPos := At( ';', xMessage ) - IF nPos == 0 - cLine := xMessage - xMessage := "" - ELSE - cLine := Left( xMessage, nPos - 1 ) - xMessage := SubStr( xMessage, nPos + 1 ) - ENDIF - IF !lTTY - DO WHILE Len( cLine ) > nDefWidth - nPos := Rat( ' ', Left( cLine, nDefWidth + 1 ) ) - IF nPos == 0 - nPos := Rat( ' ', Left( cLine, nMaxWidth + 1 ) ) - ENDIF - IF nPos == 0 - cLine := NIL - EXIT - ELSE - AAdd( aSay, Left( cLine, nPos - 1 ) ) - cLine := SubStr( cLine, nPos + 1 ) - ENDIF - ENDDO - ENDIF - IF cLine != NIL - AAdd( aSay, cLine ) - ENDIF - ENDDO + cMessage := StrTran( xMessage, ";", Chr( 10 ) ) #else @@ -129,68 +78,31 @@ FUNCTION Alert( xMessage, aOptions, cColorNorm, nDelay ) RETURN NIL ENDIF + cMessage := "" + IF ISARRAY( xMessage ) + lFirst := .T. FOR nEval := 1 TO Len( xMessage ) IF ISCHARACTER( cLine := xMessage[ nEval ] ) - IF !lTTY - DO WHILE Len( cLine ) > nDefWidth - nPos := Rat( ' ', Left( cLine, nDefWidth + 1 ) ) - IF nPos == 0 - nPos := Rat( ' ', Left( cLine, nMaxWidth + 1 ) ) - ENDIF - IF nPos == 0 - AAdd( aSay, Left( cLine, nMaxWidth ) ) - cLine := SubStr( cLine, nMaxWidth + 1 ) - ELSE - AAdd( aSay, Left( cLine, nPos - 1 ) ) - cLine := SubStr( cLine, nPos + 1 ) - ENDIF - ENDDO - ENDIF - AAdd( aSay, cLine ) + cMessage += IIF( lFirst, "", Chr( 10 ) ) + cLine + lFirst := .F. ENDIF NEXT ELSE DO CASE - CASE ValType( xMessage ) $ "CM" /* Do nothing, just speed up things */ - CASE ValType( xMessage ) == "N" ; xMessage := LTrim( Str( xMessage ) ) - CASE ValType( xMessage ) == "D" ; xMessage := DToC( xMessage ) - CASE ValType( xMessage ) == "L" ; xMessage := iif( xMessage, ".T.", ".F." ) - CASE ValType( xMessage ) == "O" ; xMessage := xMessage:className + " Object" - CASE ValType( xMessage ) == "B" ; xMessage := "{||...}" - OTHERWISE ; xMessage := "NIL" + CASE ValType( xMessage ) $ "CM" ; cMessage := StrTran( xMessage, ";", Chr( 10 ) ) + CASE ValType( xMessage ) == "N" ; cMessage := LTrim( Str( xMessage ) ) + CASE ValType( xMessage ) == "D" ; cMessage := DToC( xMessage ) + CASE ValType( xMessage ) == "L" ; cMessage := iif( xMessage, ".T.", ".F." ) + CASE ValType( xMessage ) == "O" ; cMessage := xMessage:className + " Object" + CASE ValType( xMessage ) == "S" ; cMessage := "@" + xMessage:Name + "()" + CASE ValType( xMessage ) == "B" ; cMessage := "{||...}" + OTHERWISE ; cMessage := "NIL" ENDCASE - DO WHILE Len( xMessage ) != 0 - nPos := At( ';', xMessage ) - IF nPos == 0 - cLine := xMessage - xMessage := "" - ELSE - cLine := Left( xMessage, nPos - 1 ) - xMessage := SubStr( xMessage, nPos + 1 ) - ENDIF - IF !lTTY - DO WHILE Len( cLine ) > nDefWidth - nPos := Rat( ' ', Left( cLine, nDefWidth + 1 ) ) - IF nPos == 0 - nPos := Rat( ' ', Left( cLine, nMaxWidth + 1 ) ) - ENDIF - IF nPos == 0 - AAdd( aSay, Left( cLine, nMaxWidth ) ) - cLine := SubStr( cLine, nMaxWidth + 1 ) - ELSE - AAdd( aSay, Left( cLine, nPos - 1 ) ) - cLine := SubStr( cLine, nPos + 1 ) - ENDIF - ENDDO - ENDIF - AAdd( aSay, cLine ) - ENDDO - ENDIF #endif @@ -211,11 +123,6 @@ FUNCTION Alert( xMessage, aOptions, cColorNorm, nDelay ) nDelay := 0 ENDIF - /* The longest line */ - nWidth := 0 - AEval( aSay, {| x | nWidth := Max( Len( x ), nWidth ) } ) - - /* Cleanup the button array */ aOptionsOK := {} FOR nEval := 1 TO Len( aOptions ) IF ISCHARACTER( aOptions[ nEval ] ) .AND. !Empty( aOptions[ nEval ] ) @@ -232,200 +139,7 @@ FUNCTION Alert( xMessage, aOptions, cColorNorm, nDelay ) #endif ENDIF - /* Total width of the botton line (the one with choices) */ - nOpWidth := 0 - AEval( aOptionsOK, {| x | nOpWidth += Len( x ) + 4 } ) - - /* what's wider ? */ - nWidth := Max( nWidth + 2 + iif( Len( aSay ) == 1, 4, 0 ), nOpWidth + 2 ) - - /* box coordinates */ - nInitRow := Int( ( ( MaxRow() - ( Len( aSay ) + 4 ) ) / 2 ) + .5 ) - nInitCol := Int( ( ( MaxCol() - ( nWidth + 2 ) ) / 2 ) + .5 ) - - /* detect prompts positions */ - aPos := {} - aHotkey := {} - nCurrent := nInitCol + Int( ( nWidth - nOpWidth ) / 2 ) + 2 - IF nCurrent < 0 - nCurrent := 0 - ENDIF - AEval( aOptionsOK, {| x | AAdd( aPos, nCurrent ), AAdd( aHotKey, Upper( Left( x, 1 ) ) ), nCurrent += Len( x ) + 4 } ) - - nChoice := 1 - - IF lTTY - - FOR nEval := 1 TO Len( aSay ) - OutStd( aSay[ nEval ] ) - IF nEval < Len( aSay ) - OutStd( hb_OSNewLine() ) - ENDIF - NEXT - - OutStd( " (" ) - FOR nEval := 1 TO Len( aOptionsOK ) - OutStd( aOptionsOK[ nEval ] ) - IF nEval < Len( aOptionsOK ) - OutStd( ", " ) - ENDIF - NEXT - OutStd( ") " ) - - /* choice loop */ - DO WHILE .T. - - nKey := iif( hb_gtInfo( GTI_KBDSUPPORT ), ; - Inkey( nDelay, INKEY_ALL ), 0 ) - - DO CASE - - CASE nKey == 0 - IF Len( aHotkey ) > 0 - nChoice := 1 - ENDIF - EXIT - - CASE nKey == K_ESC - - nChoice := 0 - EXIT - - CASE nKey >= 32 .AND. nKey <= 255 - - cKey := Upper( Chr( nKey ) ) - nChoice := aScan( aHotkey, {| x | x == cKey } ) - IF nChoice != 0 - EXIT - ENDIF - - ENDCASE - - ENDDO - - IF nKey >= 32 && nKey <= 255 - OutStd( Chr( nKey ) ) - ENDIF - - ELSE - - /* PreExt */ - nCount := nOldDispCount := DispCount() - - DO WHILE nCount-- != 0 - DispEnd() - ENDDO - - /* save status */ - nOldRow := Row() - nOldCol := Col() - nOldCursor := SetCursor( SC_NONE ) - cOldScreen := SaveScreen( nInitRow, nInitCol, nInitRow + Len( aSay ) + 3, nInitCol + nWidth + 1 ) - - DispBegin() - /* draw box */ - //Fixed box characters cannot be displayed correctly on some terminals - //(e.g. xterm) - //DispBox( nInitRow, nInitCol, nInitRow + Len( aSay ) + 3, nInitCol + nWidth + 1, B_SINGLE + ' ', cColorNorm ) - - @ nInitRow, nInitCol TO nInitRow + Len( aSay ) + 3, nInitCol + nWidth + 1 COLOR cColorNorm - DispBox( nInitRow + 1, nInitCol + 1, nInitRow + Len( aSay ) + 2, nInitCol + nWidth, " ", cColorNorm ) - - FOR nEval := 1 TO Len( aSay ) - DispOutAt( nInitRow + nEval, nInitCol + 1 + Int( ( ( nWidth - Len( aSay[ nEval ] ) ) / 2 ) + .5 ), aSay[ nEval ], cColorNorm ) - NEXT - - /* choice loop */ - DO WHILE .T. - - FOR nEval := 1 TO Len( aOptionsOK ) - DispOutAt( nInitRow + Len( aSay ) + 2, aPos[ nEval ], " " + aOptionsOK[ nEval ] + " ",; - iif( nEval == nChoice, cColorHigh, cColorNorm ) ) - NEXT - DispEnd() - - nKey := Inkey( nDelay, INKEY_ALL ) - - DO CASE - CASE nKey == K_ENTER .OR. ; - nKey == K_SPACE .OR. ; - nKey == 0 - - EXIT - - CASE nKey == K_ESC - - nChoice := 0 - EXIT - -#ifdef HB_COMPAT_C53 - - CASE nKey == K_LBUTTONDOWN - - nMRow := MRow() - nMCol := MCol() - - FOR nEval := 1 TO Len( aOptionsOK ) - IF nMRow == nInitRow + Len( aSay ) + 2 .AND. ; - nMCol >= aPos[ nEval ] .AND. nMCol <= aPos[ nEval ] + ; - Len( aOptionsOK[ nEval ] ) + 2 - 1 - nChoice := nEval - EXIT - ENDIF - NEXT - - IF nChoice == nEval - nChoice := 0 - EXIT - ENDIF - -#endif - - CASE ( nKey == K_LEFT .OR. nKey == K_SH_TAB ) .AND. Len( aOptionsOK ) > 1 - - nChoice-- - IF nChoice == 0 - nChoice := Len( aOptionsOK ) - ENDIF - - nDelay := 0 - - CASE ( nKey == K_RIGHT .OR. nKey == K_TAB ) .AND. Len( aOptionsOK ) > 1 - - nChoice++ - IF nChoice > Len( aOptionsOK ) - nChoice := 1 - ENDIF - - nDelay := 0 - - CASE nKey > 32 .AND. nKey <= 255 - - cKey := Upper( Chr( nKey ) ) - nChoice := aScan( aHotkey, {| x | x == cKey } ) - IF nChoice != 0 - EXIT - ENDIF - - ENDCASE - - DispBegin() - - ENDDO - - /* Restore status */ - RestScreen( nInitRow, nInitCol, nInitRow + Len( aSay ) + 3, nInitCol + nWidth + 1, cOldScreen ) - SetCursor( nOldCursor ) - SetPos( nOldRow, nOldCol ) - - /* PostExt */ - DO WHILE nOldDispCount-- != 0 - DispBegin() - ENDDO - - ENDIF - - RETURN nChoice + RETURN HB_gtAlert( cMessage, aOptionsOK, cColorNorm, cColorHigh, nDelay ); #ifdef HB_C52_UNDOC diff --git a/harbour/source/rtl/dates.c b/harbour/source/rtl/dates.c index 4a2b5c9463..d2cbd0012a 100644 --- a/harbour/source/rtl/dates.c +++ b/harbour/source/rtl/dates.c @@ -94,10 +94,10 @@ HB_EXPORT char * hb_dateFormat( const char * szDate, char * szFormattedDate, con while( format_count < size ) { - digit = toupper( *szPtr ); + digit = toupper( ( UCHAR ) *szPtr ); szPtr++; digit_count = 1; - while( toupper( *szPtr ) == digit && format_count < size ) + while( toupper( ( UCHAR ) *szPtr ) == digit && format_count < size ) { szPtr++; if( format_count + digit_count < size ) digit_count++; @@ -144,14 +144,14 @@ HB_EXPORT char * hb_dateFormat( const char * szDate, char * szFormattedDate, con case 4: if( ! used_m && format_count < size ) { -/* szFormattedDate[ format_count++ ] = '0'; */ + /* szFormattedDate[ format_count++ ] = '0'; */ szFormattedDate[ format_count++ ] = szDate[ 4 ]; digit_count--; } case 3: if( ! used_m && format_count < size ) { -/* szFormattedDate[ format_count++ ] = '0'; */ + /* szFormattedDate[ format_count++ ] = '0'; */ szFormattedDate[ format_count++ ] = szDate[ 4 ]; digit_count--; } diff --git a/harbour/source/rtl/fstemp.c b/harbour/source/rtl/fstemp.c index 87f080d281..9e4eb7631a 100644 --- a/harbour/source/rtl/fstemp.c +++ b/harbour/source/rtl/fstemp.c @@ -142,35 +142,30 @@ HB_EXPORT FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, } #else -#include /* isupper()/islower() */ #include "hbset.h" static BOOL fsGetTempDirByCase( BYTE *pszName, const char *pszTempDir ) { - BOOL bOk= FALSE; - if ( pszTempDir != NULL && *pszTempDir != '\0' ) + BOOL fOK = FALSE; + + if( pszTempDir != NULL && *pszTempDir != '\0' ) { - bOk = TRUE; hb_strncpy( ( char * ) pszName, ( char * ) pszTempDir, _POSIX_PATH_MAX ); - if ( hb_set.HB_SET_DIRCASE == HB_SET_CASE_LOWER || hb_set.HB_SET_DIRCASE == HB_SET_CASE_UPPER ) + if( hb_set.HB_SET_DIRCASE == HB_SET_CASE_LOWER ) { - /* check to see if temp directory already upper or lower. If not use current directory ( "." ) */ - char *psZ = ( char * ) pszName ; - int iChar ; - BOOL bLower = hb_set.HB_SET_DIRCASE == HB_SET_CASE_LOWER ; - while( *psZ ) - { - iChar = ( int ) *psZ; - if( isalpha( iChar ) && !( bLower ? islower( iChar ) : isupper( iChar ) ) ) - { - bOk = FALSE; - break; - } - psZ++ ; - } + hb_strLower( ( char * ) pszName, strlen( ( char * ) pszName ) ); + fOK = strcmp( ( char * ) pszName, pszTempDir ) == 0; } + else if( hb_set.HB_SET_DIRCASE == HB_SET_CASE_UPPER ) + { + hb_strUpper( ( char * ) pszName, strlen( ( char * ) pszName ) ); + fOK = strcmp( ( char * ) pszName, pszTempDir ) == 0; + } + else + fOK = TRUE; } - return( bOk ) ; + + return fOK; } HB_EXPORT FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, USHORT uiAttr, BYTE * pszName ) @@ -202,26 +197,32 @@ HB_EXPORT FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, pszName[ len + 1 ] = '\0'; } - if ( pszPrefix != NULL ) + if( pszPrefix != NULL ) { hb_strncat( ( char * ) pszName, ( char * ) pszPrefix, _POSIX_PATH_MAX ); } iLen = strlen( ( char * ) pszName ); - if ( iLen > _POSIX_PATH_MAX - 6 ) + if( iLen > _POSIX_PATH_MAX - 6 ) return FS_ERROR; #if !defined(__WATCOMC__) && ( defined( HB_OS_LINUX ) || defined( HB_OS_BSD ) ) - if( hb_set.HB_SET_FILECASE == HB_SET_CASE_LOWER || - hb_set.HB_SET_FILECASE == HB_SET_CASE_UPPER || - hb_set.HB_SET_DIRCASE == HB_SET_CASE_LOWER || - hb_set.HB_SET_DIRCASE == HB_SET_CASE_UPPER ) + if( hb_set.HB_SET_FILECASE != HB_SET_CASE_LOWER && + hb_set.HB_SET_FILECASE != HB_SET_CASE_UPPER && + hb_set.HB_SET_DIRCASE != HB_SET_CASE_LOWER && + hb_set.HB_SET_DIRCASE != HB_SET_CASE_UPPER ) + { + hb_strncat( ( char * ) pszName, "XXXXXX", _POSIX_PATH_MAX ); + fd = (FHANDLE) mkstemp( ( char * ) pszName ); + hb_fsSetIOError( fd != (FHANDLE) -1, 0 ); + } + else #endif { int i, n; double d = hb_random_num(), x; - for ( i = 0; i < 6; i++ ) + for( i = 0; i < 6; i++ ) { d = d * 36; n = ( int ) d; @@ -231,18 +232,9 @@ HB_EXPORT FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, hb_fileNameConv( ( char * ) pszName ); fd = hb_fsCreateEx( pszName, uiAttr, FO_EXCLUSIVE | FO_EXCL ); } -#if !defined(__WATCOMC__) && ( defined( HB_OS_LINUX ) || defined( HB_OS_BSD ) ) - else - { - hb_strncat( ( char * ) pszName, "XXXXXX", _POSIX_PATH_MAX ); - fd = (FHANDLE) mkstemp( ( char * ) pszName ); - hb_fsSetIOError( fd != (FHANDLE) -1, 0 ); - } -#endif - if ( fd != (FHANDLE) -1 ) - { + + if( fd != (FHANDLE) FS_ERROR ) return fd; - } } while( --iAttemptLeft ); diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 8ed00a7d86..0186c00202 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -599,6 +599,12 @@ ERRCODE hb_gtInfo( int iType, PHB_GT_INFO pInfo ) return FAILURE; } +int hb_gtAlert( PHB_ITEM pMessage, PHB_ITEM pOptions, + int iClrNorm, int iClrHigh, double dDelay ) +{ + return hb_gt_Alert( pMessage, pOptions, iClrNorm, iClrHigh, dDelay ); +} + int hb_gtSetFlag( int iType, int iNewValue ) { return hb_gt_SetFlag( iType, iNewValue ); diff --git a/harbour/source/rtl/gtfunc.c b/harbour/source/rtl/gtfunc.c index 0fddba6719..54d39ee2fb 100644 --- a/harbour/source/rtl/gtfunc.c +++ b/harbour/source/rtl/gtfunc.c @@ -126,6 +126,15 @@ HB_FUNC( HB_GTVERSION ) hb_retc( hb_gtVersion( hb_parni( 1 ) ) ); } +HB_FUNC( HB_GTALERT ) +{ + int iClrNorm = ISCHAR( 3 ) ? hb_gtColorToN( hb_parc( 3 ) ) : hb_parni( 3 ), + iClrHigh = ISCHAR( 4 ) ? hb_gtColorToN( hb_parc( 4 ) ) : hb_parni( 4 ); + + hb_retni( hb_gtAlert( hb_param( 1, HB_IT_ANY ), hb_param( 2, HB_IT_ANY ), + iClrNorm, iClrHigh, hb_parnd( 5 ) ) ); +} + HB_FUNC( HB_GFXPRIMITIVE ) { PHB_ITEM pType = hb_param( 1, HB_IT_NUMERIC ); diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index c352659b0e..15d4b3b980 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -318,7 +318,7 @@ static int hb_gt_def_ColorNum( const char * szColorString ) while( ( c = *szColorString++ ) != 0 ) { - switch( toupper( ( BYTE ) c ) ) + switch( toupper( ( UCHAR ) c ) ) { case '*': nColor |= 0x80; @@ -405,7 +405,7 @@ static void hb_gt_def_StringToColors( const char * szColorString, int ** pColors ++nCount; - switch( toupper( c ) ) + switch( toupper( ( UCHAR ) c ) ) { case 'B': nColor |= 1; @@ -1487,6 +1487,337 @@ static BOOL hb_gt_def_Info( int iType, PHB_GT_INFO pInfo ) return TRUE; } +static int hb_gt_def_Alert( PHB_ITEM pMessage, PHB_ITEM pOptions, + int iClrNorm, int iClrHigh, double dDelay ) +{ + int iOptions = ( int ) hb_arrayLen( pOptions ); + int iRet = 0; + + if( HB_IS_STRING( pMessage ) && iOptions > 0 ) + { + char * szMessage = hb_itemGetCPtr( pMessage ); + ULONG ulLen = hb_itemGetCLen( pMessage ); + BOOL fScreen = FALSE, fKeyBoard = FALSE; + int iKey = 0, i, iDspCount, iStyle, iRows, iCols, + iRow, iCol, iTop, iLeft, iBottom, iRight, iMnuCol, iPos, iClr; + BYTE * pBuffer = NULL; + HB_GT_INFO gtInfo; + + gtInfo.pNewVal = gtInfo.pResult = NULL; + + hb_gt_Info( GTI_FULLSCREEN, >Info ); + if( gtInfo.pResult ) + { + fScreen = hb_itemGetL( gtInfo.pResult ); + } + hb_gt_Info( GTI_KBDSUPPORT, >Info ); + if( gtInfo.pResult ) + { + fKeyBoard = hb_itemGetL( gtInfo.pResult ); + hb_itemRelease( gtInfo.pResult ); + } + hb_gt_GetSize( &iRows, &iCols ); + if( iCols <= 4 || iRows <= 4 ) + fScreen = FALSE; + + if( fScreen ) + { + ULONG ulLines = 0, ulWidth = 0, ulCurrWidth = 0, ul = 0, ulDst = 0, + ulLast = 0, ulSpace1 = 0, ulSpace2 = 0, ulDefWidth, ulMaxWidth; + char * szMsgDsp; + + ulMaxWidth = iCols - 4; + ulDefWidth = ( ulMaxWidth >> 2 ) * 3; + szMsgDsp = ( char * ) hb_xgrab( ulLen + ( ulLen / ulDefWidth ) + 1 ); + + while( ul < ulLen ) + { + if( szMessage[ ul ] == '\n' ) + { + if( ulCurrWidth > ulMaxWidth ) + { + ulDst = ulLast; + } + else + { + ++ulLines; + if( ulCurrWidth > ulWidth ) + ulWidth = ulCurrWidth; + ulCurrWidth = ulSpace1 = ulSpace2 = 0; + szMsgDsp[ ulDst++ ] = '\n'; + ulLast = ulDst; + } + } + else + { + if( szMessage[ ul ] == ' ' ) + { + if( ulCurrWidth <= ulDefWidth ) + ulSpace1 = ul; + else if( ulCurrWidth <= ulMaxWidth && !ulSpace2 ) + ulSpace2 = ul; + } + szMsgDsp[ ulDst++ ] = szMessage[ ul ]; + ++ulCurrWidth; + if( ulCurrWidth > ulDefWidth && ulSpace1 ) + { + ulCurrWidth -= ul - ulSpace1 + 1; + ulDst -= ul - ulSpace1 + 1; + ul = ulSpace1; + ++ulLines; + if( ulCurrWidth > ulWidth ) + ulWidth = ulCurrWidth; + ulCurrWidth = ulSpace1 = ulSpace2 = 0; + szMsgDsp[ ulDst++ ] = '\n'; + ulLast = ulDst; + } + else if( ulCurrWidth > ulMaxWidth ) + { + if( ulSpace2 ) + { + ulCurrWidth -= ul - ulSpace2 + 1; + ulDst -= ul - ulSpace2 + 1; + ul = ulSpace2; + ++ulLines; + if( ulCurrWidth > ulWidth ) + ulWidth = ulCurrWidth; + ulCurrWidth = ulSpace1 = ulSpace2 = 0; + szMsgDsp[ ulDst++ ] = '\n'; + ulLast = ulDst; + } +#ifndef HB_C52_STRICT + else + { + ulCurrWidth--; + ulDst--; + ul--; + szMsgDsp[ ulDst++ ] = '\n'; + ulLast = ulDst; + ++ulLines; + if( ulCurrWidth > ulWidth ) + ulWidth = ulCurrWidth; + ulCurrWidth = ulSpace1 = ulSpace2 = 0; + } +#endif + } + } + ++ul; + } + ulLines++; + if( ulCurrWidth > ulWidth ) + ulWidth = ulCurrWidth; + if( ulLines == 1 && ulWidth < ulDefWidth ) + ulWidth += HB_MIN( 4, ulDefWidth - ulWidth ); + + ulCurrWidth = 0; + for( i = 1; i <= iOptions; ++i ) + { + ulCurrWidth += hb_arrayGetCLen( pOptions, i ) + 4; + } + if( ulCurrWidth > ulMaxWidth ) + ulCurrWidth = ulMaxWidth; + if( ulCurrWidth > ulWidth ) + ulWidth = ulCurrWidth; + if( ( ULONG ) iRows < ulLines + 4 ) + ulLines = iRows - 4; + iTop = ( iRows - ulLines - 4 ) >> 1; + iLeft = ( iCols - ulWidth - 4 ) >> 1; + iBottom = iTop + ulLines + 3; + iRight = iLeft + ulWidth + 3; + + if( iClrNorm == 0 ) + iClrNorm = 79; + if( iClrHigh == 0 ) + iClrHigh = 31; + iDspCount = hb_gt_DispCount(); + if( iDspCount == 0 ) + hb_gt_DispBegin(); + hb_gt_GetPos( &iRow, &iCol ); + iStyle = hb_gt_GetCursorStyle(); + hb_gt_SetCursorStyle( SC_NONE ); + ulLen = hb_gt_RectSize( iTop, iLeft, iBottom, iRight ); + if( ulLen ) + { + pBuffer = ( BYTE * ) hb_xgrab( ulLen ); + hb_gt_Save( iTop, iLeft, iBottom, iRight, pBuffer ); + } + hb_gt_BoxS( iTop, iLeft, iBottom, iRight, NULL, iClrNorm ); + hb_gt_Box( iTop + 1, iLeft + 1, iBottom - 1, iRight - 1, ( BYTE * ) " ", iClrNorm ); + ulLast = 0; + i = iTop + 1; + for( ul = 0; ul < ulDst; ++ul ) + { + if( szMsgDsp[ ul ] == '\n' ) + { + if( ul > ulLast ) + { + ulLen = ul - ulLast; + if( ulLen > ulWidth ) + ulLen = ulWidth; + hb_gt_PutText( i, iLeft + ( ( ulWidth - ulLen + 1 ) >> 1 ) + 2, + iClrNorm, ( BYTE * ) szMsgDsp + ulLast, ulLen ); + } + ulLast = ul + 1; + if( ++i >= iBottom - 1 ) + break; + } + } + if( ul > ulLast && i < iBottom - 1 ) + { + ulLen = ul - ulLast; + if( ulLen > ulWidth ) + ulLen = ulWidth; + hb_gt_PutText( i, iLeft + ( ( ulWidth - ulLen + 1 ) >> 1 ) + 2, + iClrNorm, ( BYTE * ) szMsgDsp + ulLast, ulLen ); + } + + iPos = 1; + while( iRet == 0 ) + { + hb_gt_DispBegin(); + iMnuCol = iLeft + ( ( ulWidth - ulCurrWidth ) >> 1 ) + 3; + for( i = 1; i <= iOptions; ++i ) + { + iClr = i == iPos ? iClrHigh : iClrNorm; + ulLen = hb_arrayGetCLen( pOptions, i ); + hb_gt_PutText( iBottom - 1, iMnuCol, iClr, ( BYTE * ) " ", 1 ); + hb_gt_PutText( iBottom - 1, iMnuCol + 1, iClr, + ( BYTE * ) hb_arrayGetCPtr( pOptions, i ), ulLen ); + hb_gt_PutText( iBottom - 1, iMnuCol + 1 + ulLen, iClr, ( BYTE * ) " ", 1 ); + iMnuCol += ulLen + 4; + } + while( hb_gt_DispCount() ) + hb_gt_DispEnd(); + hb_gt_Refresh(); + + iKey = fKeyBoard ? hb_inkey( TRUE, dDelay, INKEY_ALL ) : 0; + + if( iKey == K_ESC ) + break; + else if( iKey == K_ENTER || iKey == K_SPACE || iKey == 0 ) + { + iRet = iPos; + } + else if( iKey == K_LEFT || iKey == K_SH_TAB ) + { + if( --iPos == 0 ) + iPos = iOptions; + dDelay = 0.0; + } + else if( iKey == K_RIGHT || iKey == K_TAB ) + { + if( ++iPos > iOptions ) + iPos = 1; + dDelay = 0.0; + } +#ifdef HB_COMPAT_C53 + else if( iKey == K_LBUTTONDOWN ) + { + int iMRow, iMCol; + hb_mouse_GetPos( &iMRow, &iMCol ); + if( iMRow == iBottom - 1 ) + { + iMnuCol = iLeft + ( ( ulWidth - ulCurrWidth ) >> 1 ) + 4; + for( i = 1; i <= iOptions; ++i ) + { + ulLen = hb_arrayGetCLen( pOptions, i ); + if( iMCol >= iMnuCol && iMCol < iMnuCol + ( int ) ulLen ) + { + iRet = i; + break; + } + iMnuCol += ulLen + 4; + } + } + } +#endif + else if( iKey >= 32 && iKey <= 255 ) + { + int iUp = hb_charUpper( iKey ); + for( i = 1; i <= iOptions; ++i ) + { + char *szValue = hb_arrayGetCPtr( pOptions, i ); + if( szValue && iUp == hb_charUpper( *szValue ) ) + { + iRet = i; + break; + } + } + } + } + + hb_xfree( szMsgDsp ); + if( pBuffer ) + { + hb_gt_Rest( iTop, iLeft, iBottom, iRight, pBuffer ); + hb_xfree( pBuffer ); + } + hb_gt_SetPos( iRow, iCol ); + hb_gt_SetCursorStyle( iStyle ); + hb_gt_Refresh(); + while( hb_gt_DispCount() < iDspCount ) + hb_gt_DispBegin(); + } + else + { + ULONG ul, ulStart = 0; + char *szEol = hb_conNewLine(); + + for( ul = 0; ul < ulLen; ++ul ) + { + if( szMessage[ ul ] == '\n' ) + { + if( ul > ulStart ) + hb_gt_WriteCon( ( BYTE * ) szMessage + ulStart, ul - ulStart ); + hb_gt_WriteCon( ( BYTE * ) szEol, strlen( szEol ) ); + ulStart = ul + 1; + } + } + if( ul > ulStart ) + hb_gt_WriteCon( ( BYTE * ) szMessage + ulStart, ul - ulStart ); + hb_gt_WriteCon( ( BYTE * ) " (", 2 ); + for( i = 1; i <= iOptions; ++i ) + { + if( i > 1 ) + hb_gt_WriteCon( ( BYTE * ) ", ", 2 ); + hb_gt_WriteCon( ( BYTE * ) hb_arrayGetCPtr( pOptions, i ), + hb_arrayGetCLen( pOptions, i ) ); + } + hb_gt_WriteCon( ( BYTE * ) ") ", 2 ); + while( iRet == 0 ) + { + iKey = fKeyBoard ? hb_inkey( TRUE, dDelay, INKEY_ALL ) : 0; + if( iKey == 0 ) + iRet = 1; + else if( iKey == K_ESC ) + break; + else if( iKey >= 32 && iKey <= 255 ) + { + int iUp = hb_charUpper( iKey ); + for( i = 1; i <= iOptions; ++i ) + { + char *szValue = hb_arrayGetCPtr( pOptions, i ); + if( szValue && iUp == hb_charUpper( *szValue ) ) + { + iRet = i; + break; + } + } + } + } + if( iKey >= 32 && iKey <= 255 ) + { + char szVal[2]; + szVal[ 0 ] = ( char ) iKey; + szVal[ 1 ] = '\0'; + hb_gt_WriteCon( ( BYTE * ) szVal, 1 ); + } + } + } + + return iRet; +} + static int hb_gt_def_SetFlag( int iType, int iNewValue ) { int iPrevValue = 0; @@ -2084,6 +2415,7 @@ static HB_GT_FUNCS gtCoreFunc = Tone : hb_gt_def_Tone , Bell : hb_gt_def_Bell , Info : hb_gt_def_Info , + Alert : hb_gt_def_Alert , SetFlag : hb_gt_def_SetFlag , SetDispCP : hb_gt_def_SetDispCP , SetKeyCP : hb_gt_def_SetKeyCP , @@ -2190,6 +2522,7 @@ static HB_GT_FUNCS gtCoreFunc = hb_gt_def_Tone , hb_gt_def_Bell , hb_gt_def_Info , + hb_gt_def_Alert , hb_gt_def_SetFlag , hb_gt_def_SetDispCP , hb_gt_def_SetKeyCP , @@ -2594,6 +2927,12 @@ BOOL hb_gt_Info( int iType, PHB_GT_INFO pInfo ) return gtCoreFunc.Info( iType, pInfo ); } +int hb_gt_Alert( PHB_ITEM pMessage, PHB_ITEM pOptions, + int iClrNorm, int iClrHigh, double dDelay ) +{ + return gtCoreFunc.Alert( pMessage, pOptions, iClrNorm, iClrHigh, dDelay ); +} + int hb_gt_SetFlag( int iType, int iNewValue ) { return gtCoreFunc.SetFlag( iType, iNewValue ); diff --git a/harbour/source/rtl/set.c b/harbour/source/rtl/set.c index 7b0c14eae6..29b9a0c011 100644 --- a/harbour/source/rtl/set.c +++ b/harbour/source/rtl/set.c @@ -116,13 +116,13 @@ static BOOL set_logical( PHB_ITEM pItem, BOOL bDefault ) ULONG ulLen = hb_itemGetCLen( pItem ); if( ulLen >= 2 - && toupper( szString[ 0 ] ) == 'O' - && toupper( szString[ 1 ] ) == 'N' ) + && toupper( ( UCHAR ) szString[ 0 ] ) == 'O' + && toupper( ( UCHAR ) szString[ 1 ] ) == 'N' ) bLogical = TRUE; else if( ulLen >= 3 - && toupper( szString[ 0 ] ) == 'O' - && toupper( szString[ 1 ] ) == 'F' - && toupper( szString[ 2 ] ) == 'F' ) + && toupper( ( UCHAR ) szString[ 0 ] ) == 'O' + && toupper( ( UCHAR ) szString[ 1 ] ) == 'F' + && toupper( ( UCHAR ) szString[ 2 ] ) == 'F' ) bLogical = FALSE; } @@ -335,13 +335,13 @@ HB_FUNC( __SETCENTURY ) ULONG ulLen = hb_parclen( 1 ); if( ulLen >= 2 - && toupper( szString[ 0 ] ) == 'O' - && toupper( szString[ 1 ] ) == 'N' ) + && toupper( ( UCHAR ) szString[ 0 ] ) == 'O' + && toupper( ( UCHAR ) szString[ 1 ] ) == 'N' ) hb_set.hb_set_century = TRUE; else if( ulLen >= 3 - && toupper( szString[ 0 ] ) == 'O' - && toupper( szString[ 1 ] ) == 'F' - && toupper( szString[ 2 ] ) == 'F' ) + && toupper( ( UCHAR ) szString[ 0 ] ) == 'O' + && toupper( ( UCHAR ) szString[ 1 ] ) == 'F' + && toupper( ( UCHAR ) szString[ 2 ] ) == 'F' ) hb_set.hb_set_century = FALSE; } @@ -360,7 +360,7 @@ HB_FUNC( __SETCENTURY ) size = strlen( szDateFormat ); for( count = 0; count < size; count++ ) { - digit = toupper( szDateFormat[ count ] ); + digit = toupper( ( UCHAR ) szDateFormat[ count ] ); if( digit == 'Y' ) { if( y_start == -1 ) y_start = count; diff --git a/harbour/source/rtl/strcase.c b/harbour/source/rtl/strcase.c index 8ce2e713ee..d55e8d6524 100644 --- a/harbour/source/rtl/strcase.c +++ b/harbour/source/rtl/strcase.c @@ -91,6 +91,24 @@ char * hb_strUpper( char * szText, ULONG ulLen ) return szText; } +/* converts iChar to upper case */ +int hb_charUpper( int iChar ) +{ + if( hb_cdp_page->nChars ) + return (unsigned char) hb_cdp_page->s_upper[ (unsigned char) iChar ]; + else + return toupper( (unsigned char) iChar ); +} + +/* converts iChar to lower case */ +int hb_charLower( int iChar ) +{ + if( hb_cdp_page->nChars ) + return (unsigned char) hb_cdp_page->s_lower[ (unsigned char) iChar ]; + else + return tolower( (unsigned char) iChar ); +} + /* converts string to lower case */ HB_FUNC( LOWER ) { diff --git a/harbour/source/rtl/strmatch.c b/harbour/source/rtl/strmatch.c index 8664f8098a..eef1b4707e 100644 --- a/harbour/source/rtl/strmatch.c +++ b/harbour/source/rtl/strmatch.c @@ -71,12 +71,12 @@ static BOOL hb_strMatchDOS( const char * pszString, const char * pszMask ) pszString++; else { - while( toupper( *pszString ) != toupper( *pszMask ) ) + while( hb_charUpper( *pszString ) != hb_charUpper( *pszMask ) ) { if( *( ++pszString ) == '\0' ) return FALSE; } - while( toupper( *pszString ) == toupper( *pszMask ) ) + while( hb_charUpper( *pszString ) == hb_charUpper( *pszMask ) ) { if( *( ++pszString ) == '\0' ) break; @@ -84,7 +84,7 @@ static BOOL hb_strMatchDOS( const char * pszString, const char * pszMask ) pszMask++; } } - else if( toupper( *pszMask ) != toupper( *pszString ) && *pszMask != '?' ) + else if( hb_charUpper( *pszMask ) != hb_charUpper( *pszString ) && *pszMask != '?' ) return FALSE; else { diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index 038d4f3119..1dda6c2db6 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -86,8 +86,6 @@ #define PF_WIDTH 0x0800 /* @S */ #define PF_PARNEGWOS 0x1000 /* @) Similar to PF_PARNEG but without leading spaces */ -#define TOUPPER(c) ((hb_cdp_page->nChars)? (char)hb_cdp_page->s_upper[(UCHAR)c] : (char)toupper((UCHAR)(c))) - HB_FUNC( TRANSFORM ) { PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); /* Input parameter */ @@ -131,7 +129,7 @@ HB_FUNC( TRANSFORM ) while( ulPicLen && ! bDone ) { - switch( toupper( ( UCHAR ) *szPic ) ) + switch( hb_charUpper( *szPic ) ) { case HB_CHAR_HT: case '9': @@ -234,7 +232,7 @@ HB_FUNC( TRANSFORM ) /* Upper */ case '!': { - szResult[ ulResultPos++ ] = TOUPPER( szExp[ ulExpPos ] ); + szResult[ ulResultPos++ ] = hb_charUpper( szExp[ ulExpPos ] ); ulExpPos++; bAnyPic = TRUE; break; @@ -252,7 +250,7 @@ HB_FUNC( TRANSFORM ) case 'x': case 'X': { - szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? TOUPPER( szExp[ ulExpPos ] ) : szExp[ ulExpPos ]; + szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? hb_charUpper( szExp[ ulExpPos ] ) : szExp[ ulExpPos ]; ulExpPos++; bAnyPic = TRUE; break; @@ -339,12 +337,12 @@ HB_FUNC( TRANSFORM ) break; } default: - szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? TOUPPER( *szExp ) : *szExp; + szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? hb_charUpper( *szExp ) : *szExp; } } else { - szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? TOUPPER( *szExp ) : *szExp; + szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? hb_charUpper( *szExp ) : *szExp; } szExp++; } @@ -354,7 +352,7 @@ HB_FUNC( TRANSFORM ) { while( ulExpPos++ < ulExpLen ) { - szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? TOUPPER( *szExp ) : *szExp; + szResult[ ulResultPos++ ] = ( uiPicFlags & PF_UPPER ) ? hb_charUpper( *szExp ) : *szExp; szExp++; } }