From dddbc1c824e1938624a9cd06aa67898753d06850 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 2 Nov 2008 06:34:42 +0000 Subject: [PATCH] 2008-11-02 07:33 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * include/hbstdgen.ch - Removed HB_VERSION mistakenly left there. * include/hbextern.ch * source/rtl/version.c + Added HB_OSISWINNT() + Added HB_OSISWINCE() [TOMERGE 1.0] * include/hbver.ch * source/rtl/version.c + Added: hb_version( HB_VERSION_MT ) -> hb_version( HB_VERSION_UNIX_COMPAT ) -> hb_version( HB_VERSION_PLATFORM ) -> (same as ending of __PLATFORM__* macros) This makes these functions/macros deprecated: - HB_MTVM() - __PLATFORM__* (not for all possible situations) ; TOFIX: Cleanup REVISION/SVN term usage in source. ; TOFIX: Remove HB_VER_* predefined macro usage on .prg level. ; TODO: Removed some deprecated by hb_version() functions/macros. * include/hbapi.h * source/vm/itemapi.c * source/common/hbstr.c * source/common/expropt2.c * source/rtl/chrasc.c * source/rtl/hbi18n.c * Minor formatting. --- harbour/ChangeLog | 31 ++++++++ harbour/include/hbapi.h | 20 ++--- harbour/include/hbextern.ch | 2 + harbour/include/hbstdgen.ch | 1 - harbour/include/hbver.ch | 3 + harbour/source/common/expropt2.c | 2 +- harbour/source/common/hbstr.c | 126 +++++++++++-------------------- harbour/source/rtl/chrasc.c | 2 +- harbour/source/rtl/hbi18n.c | 2 +- harbour/source/rtl/version.c | 41 ++++++++++ harbour/source/vm/itemapi.c | 12 +-- 11 files changed, 138 insertions(+), 104 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a791633081..379125851f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,37 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-11-02 07:33 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * include/hbstdgen.ch + - Removed HB_VERSION mistakenly left there. + + * include/hbextern.ch + * source/rtl/version.c + + Added HB_OSISWINNT() + + Added HB_OSISWINCE() + [TOMERGE 1.0] + + * include/hbver.ch + * source/rtl/version.c + + Added: + hb_version( HB_VERSION_MT ) -> + hb_version( HB_VERSION_UNIX_COMPAT ) -> + hb_version( HB_VERSION_PLATFORM ) -> (same as ending of __PLATFORM__* macros) + This makes these functions/macros deprecated: + - HB_MTVM() + - __PLATFORM__* (not for all possible situations) + ; TOFIX: Cleanup REVISION/SVN term usage in source. + ; TOFIX: Remove HB_VER_* predefined macro usage on .prg level. + ; TODO: Removed some deprecated by hb_version() functions/macros. + + * include/hbapi.h + * source/vm/itemapi.c + * source/common/hbstr.c + * source/common/expropt2.c + * source/rtl/chrasc.c + * source/rtl/hbi18n.c + * Minor formatting. + 2008-11-01 22:58 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/rtl/hbi18n.c * Modified __I18N_GETTEXT() to not RTE when trs table diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index e5e7b17f52..2359cdaa92 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -810,7 +810,7 @@ extern void hb_hashRefGrabage( PHB_ITEM pHash ); #define HB_ISNEXTIDCHAR(c) ( HB_ISFIRSTIDCHAR(c) || \ ( ( (c) >= '0' && (c) <= '9' ) ) ) -extern const char * hb_szAscii[256]; /* array of 1 character length strings */ +extern const char * hb_szAscii[ 256 ]; /* array of 1 character length strings */ extern HB_EXPORT int hb_stricmp( const char * s1, const char * s2 ); /* compare two strings without regards to case */ extern HB_EXPORT int hb_strnicmp( const char * s1, const char * s2, ULONG ulLen ); /* compare two string without regards to case, limited by length */ @@ -959,8 +959,8 @@ extern char * hb_conSetColor( const char * szColor ); /* retrieve and optional /* compiler and macro compiler */ extern const char * hb_compReservedName( const char * szName ); /* determines if a string contains a reserve word */ -extern char * hb_compEncodeString( int iMethod, const char * szText, ULONG * pulLen ); -extern char * hb_compDecodeString( int iMethod, const char * szText, ULONG * pulLen ); +extern char * hb_compEncodeString( int iMethod, const char * szText, ULONG * pulLen ); +extern char * hb_compDecodeString( int iMethod, const char * szText, ULONG * pulLen ); /* misc */ extern char * hb_procname( int iLevel, char * szName, BOOL bskipBlock ); /* retrieve a procedure name into a buffer */ @@ -993,12 +993,12 @@ extern void hb_idleReset( void ); /* services a single idle state */ extern void hb_idleSleep( double dSeconds ); /* sleep for a given time serving idle task */ /* misc */ -extern char * hb_verPlatform( void ); /* retrieves a newly allocated buffer containing platform version */ -extern char * hb_verCompiler( void ); /* retrieves a newly allocated buffer containing compiler version */ -extern char * hb_verHarbour( void ); /* retrieves a newly allocated buffer containing harbour version */ -extern char * hb_verPCode( void ); /* retrieves a newly allocated buffer containing PCode version */ -extern char * hb_verBuildDate( void ); /* retrieves a newly allocated buffer containing build date and time */ -extern void hb_verBuildInfo( void ); /* display harbour, compiler, and platform versions to standard console */ +extern char * hb_verPlatform( void ); /* retrieves a newly allocated buffer containing platform version */ +extern char * hb_verCompiler( void ); /* retrieves a newly allocated buffer containing compiler version */ +extern char * hb_verHarbour( void ); /* retrieves a newly allocated buffer containing harbour version */ +extern char * hb_verPCode( void ); /* retrieves a newly allocated buffer containing PCode version */ +extern char * hb_verBuildDate( void ); /* retrieves a newly allocated buffer containing build date and time */ +extern void hb_verBuildInfo( void ); /* display harbour, compiler, and platform versions to standard console */ extern int hb_verSvnID( void ); /* retrieves ChangeLog SVN revision number */ extern const char * hb_verSvnChangeLogID( void ); /* retrieves a static buffer containing ChangeLog ID string */ extern const char * hb_verSvnLastEntry( void ); /* retrieves a static buffer containing ChangeLog last entry string */ @@ -1006,7 +1006,7 @@ extern const char * hb_verFlagsC( void ); /* retrieves a static buffer extern const char * hb_verFlagsL( void ); /* retrieves a static buffer containing build time linker flags in L_USR envvar */ extern const char * hb_verFlagsPRG( void ); /* retrieves a static buffer containing build time Harbour compiler flags in PRG_USR envvar */ -extern HB_EXPORT BOOL hb_iswinnt( void ); /* return .T. if OS == WinNt, 2000, XP */ +extern HB_EXPORT BOOL hb_iswinnt( void ); /* return .T. if OS == Windows NT, 2000, XP */ extern HB_EXPORT BOOL hb_iswince( void ); /* return .T. if OS is Windows CE or Windows Mobile */ extern HB_EXPORT BOOL hb_printerIsReady( char * pszPrinterName ); diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 1454535a14..fdb843e090 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -846,6 +846,8 @@ EXTERNAL HB_IDLESTATE EXTERNAL HB_RELEASECPU EXTERNAL HB_OSNEWLINE +EXTERNAL HB_OSISWINNT +EXTERNAL HB_OSISWINCE EXTERNAL HB_APARAMS EXTERNAL HB_PVALUE EXTERNAL HB_FORNEXT diff --git a/harbour/include/hbstdgen.ch b/harbour/include/hbstdgen.ch index b2860273a3..d4b20d584c 100644 --- a/harbour/include/hbstdgen.ch +++ b/harbour/include/hbstdgen.ch @@ -63,7 +63,6 @@ #undef HB_VER_MINOR #undef HB_VER_REVISION #undef HB_VER_STATUS -#undef HB_VERSION #undef __DATE__ #undef __TIME__ diff --git a/harbour/include/hbver.ch b/harbour/include/hbver.ch index 6619040539..701b797c0d 100644 --- a/harbour/include/hbver.ch +++ b/harbour/include/hbver.ch @@ -75,6 +75,9 @@ #define HB_VERSION_FLAG_LINKER 16 #define HB_VERSION_BITWIDTH 17 #define HB_VERSION_ENDIANNESS 18 +#define HB_VERSION_MT 19 +#define HB_VERSION_UNIX_COMPAT 20 +#define HB_VERSION_PLATFORM 21 /* hb_version( HB_V_ENDIANNESS ) return values. */ #define HB_VERSION_ENDIAN_LITTLE 1 diff --git a/harbour/source/common/expropt2.c b/harbour/source/common/expropt2.c index 35d909dd55..9d1dc0c99f 100644 --- a/harbour/source/common/expropt2.c +++ b/harbour/source/common/expropt2.c @@ -1861,7 +1861,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[ toupper( ( unsigned char ) pArg->value.asString.string[ 0 ] ) ]; fDealloc = FALSE; } diff --git a/harbour/source/common/hbstr.c b/harbour/source/common/hbstr.c index 41524706c2..885dddf964 100644 --- a/harbour/source/common/hbstr.c +++ b/harbour/source/common/hbstr.c @@ -67,22 +67,22 @@ #include "hbapi.h" #include "hbmath.h" -const char * hb_szAscii[256] = { "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", - "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x1E", "\x1F", - "\x20", "\x21", "\x22", "\x23", "\x24", "\x25", "\x26", "\x27", "\x28", "\x29", "\x2A", "\x2B", "\x2C", "\x2D", "\x2E", "\x2F", - "\x30", "\x31", "\x32", "\x33", "\x34", "\x35", "\x36", "\x37", "\x38", "\x39", "\x3A", "\x3B", "\x3C", "\x3D", "\x3E", "\x3F", - "\x40", "\x41", "\x42", "\x43", "\x44", "\x45", "\x46", "\x47", "\x48", "\x49", "\x4A", "\x4B", "\x4C", "\x4D", "\x4E", "\x4F", - "\x50", "\x51", "\x52", "\x53", "\x54", "\x55", "\x56", "\x57", "\x58", "\x59", "\x5A", "\x5B", "\x5C", "\x5D", "\x5E", "\x5F", - "\x60", "\x61", "\x62", "\x63", "\x64", "\x65", "\x66", "\x67", "\x68", "\x69", "\x6A", "\x6B", "\x6C", "\x6D", "\x6E", "\x6F", - "\x70", "\x71", "\x72", "\x73", "\x74", "\x75", "\x76", "\x77", "\x78", "\x79", "\x7A", "\x7B", "\x7C", "\x7D", "\x7E", "\x7F", - "\x80", "\x81", "\x82", "\x83", "\x84", "\x85", "\x86", "\x87", "\x88", "\x89", "\x8A", "\x8B", "\x8C", "\x8D", "\x8E", "\x8F", - "\x90", "\x91", "\x92", "\x93", "\x94", "\x95", "\x96", "\x97", "\x98", "\x99", "\x9A", "\x9B", "\x9C", "\x9D", "\x9E", "\x9F", - "\xA0", "\xA1", "\xA2", "\xA3", "\xA4", "\xA5", "\xA6", "\xA7", "\xA8", "\xA9", "\xAA", "\xAB", "\xAC", "\xAD", "\xAE", "\xAF", - "\xB0", "\xB1", "\xB2", "\xB3", "\xB4", "\xB5", "\xB6", "\xB7", "\xB8", "\xB9", "\xBA", "\xBB", "\xBC", "\xBD", "\xBE", "\xBF", - "\xC0", "\xC1", "\xC2", "\xC3", "\xC4", "\xC5", "\xC6", "\xC7", "\xC8", "\xC9", "\xCA", "\xCB", "\xCC", "\xCD", "\xCE", "\xCF", - "\xD0", "\xD1", "\xD2", "\xD3", "\xD4", "\xD5", "\xD6", "\xD7", "\xD8", "\xD9", "\xDA", "\xDB", "\xDC", "\xDD", "\xDE", "\xDF", - "\xE0", "\xE1", "\xE2", "\xE3", "\xE4", "\xE5", "\xE6", "\xE7", "\xE8", "\xE9", "\xEA", "\xEB", "\xEC", "\xED", "\xEE", "\xEF", - "\xF0", "\xF1", "\xF2", "\xF3", "\xF4", "\xF5", "\xF6", "\xF7", "\xF8", "\xF9", "\xFA", "\xFB", "\xFC", "\xFD", "\xFE", "\xFF" }; +const char * hb_szAscii[ 256 ] = { "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", + "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x1E", "\x1F", + "\x20", "\x21", "\x22", "\x23", "\x24", "\x25", "\x26", "\x27", "\x28", "\x29", "\x2A", "\x2B", "\x2C", "\x2D", "\x2E", "\x2F", + "\x30", "\x31", "\x32", "\x33", "\x34", "\x35", "\x36", "\x37", "\x38", "\x39", "\x3A", "\x3B", "\x3C", "\x3D", "\x3E", "\x3F", + "\x40", "\x41", "\x42", "\x43", "\x44", "\x45", "\x46", "\x47", "\x48", "\x49", "\x4A", "\x4B", "\x4C", "\x4D", "\x4E", "\x4F", + "\x50", "\x51", "\x52", "\x53", "\x54", "\x55", "\x56", "\x57", "\x58", "\x59", "\x5A", "\x5B", "\x5C", "\x5D", "\x5E", "\x5F", + "\x60", "\x61", "\x62", "\x63", "\x64", "\x65", "\x66", "\x67", "\x68", "\x69", "\x6A", "\x6B", "\x6C", "\x6D", "\x6E", "\x6F", + "\x70", "\x71", "\x72", "\x73", "\x74", "\x75", "\x76", "\x77", "\x78", "\x79", "\x7A", "\x7B", "\x7C", "\x7D", "\x7E", "\x7F", + "\x80", "\x81", "\x82", "\x83", "\x84", "\x85", "\x86", "\x87", "\x88", "\x89", "\x8A", "\x8B", "\x8C", "\x8D", "\x8E", "\x8F", + "\x90", "\x91", "\x92", "\x93", "\x94", "\x95", "\x96", "\x97", "\x98", "\x99", "\x9A", "\x9B", "\x9C", "\x9D", "\x9E", "\x9F", + "\xA0", "\xA1", "\xA2", "\xA3", "\xA4", "\xA5", "\xA6", "\xA7", "\xA8", "\xA9", "\xAA", "\xAB", "\xAC", "\xAD", "\xAE", "\xAF", + "\xB0", "\xB1", "\xB2", "\xB3", "\xB4", "\xB5", "\xB6", "\xB7", "\xB8", "\xB9", "\xBA", "\xBB", "\xBC", "\xBD", "\xBE", "\xBF", + "\xC0", "\xC1", "\xC2", "\xC3", "\xC4", "\xC5", "\xC6", "\xC7", "\xC8", "\xC9", "\xCA", "\xCB", "\xCC", "\xCD", "\xCE", "\xCF", + "\xD0", "\xD1", "\xD2", "\xD3", "\xD4", "\xD5", "\xD6", "\xD7", "\xD8", "\xD9", "\xDA", "\xDB", "\xDC", "\xDD", "\xDE", "\xDF", + "\xE0", "\xE1", "\xE2", "\xE3", "\xE4", "\xE5", "\xE6", "\xE7", "\xE8", "\xE9", "\xEA", "\xEB", "\xEC", "\xED", "\xEE", "\xEF", + "\xF0", "\xF1", "\xF2", "\xF3", "\xF4", "\xF5", "\xF6", "\xF7", "\xF8", "\xF9", "\xFA", "\xFB", "\xFC", "\xFD", "\xFE", "\xFF" }; HB_EXPORT ULONG hb_strAt( const char * szSub, ULONG ulSubLen, const char * szText, ULONG ulLen ) { @@ -179,9 +179,7 @@ HB_EXPORT char * hb_strndup( const char * pszText, ULONG ulLen ) ul = 0; pszDup = ( char * ) pszText; while( ulLen-- && *pszDup++ ) - { ++ul; - } pszDup = ( char * ) hb_xgrab( ul + 1 ); memcpy( pszDup, pszText, ul ); @@ -197,9 +195,8 @@ HB_EXPORT ULONG hb_strnlen( const char * pszText, ULONG ulLen ) HB_TRACE(HB_TR_DEBUG, ("hb_strnlen(%s, %ld)", pszText, ulLen)); while( ulLen-- && *pszText++ ) - { ++ul; - } + return ul; } @@ -211,14 +208,11 @@ HB_EXPORT char * hb_strduptrim( const char * pszText ) HB_TRACE(HB_TR_DEBUG, ("hb_strduptrim(%s)", pszText)); while( pszText[ 0 ] == ' ' ) - { ++pszText; - } + ulLen = strlen( pszText ); while( ulLen && pszText[ ulLen - 1 ] == ' ' ) - { --ulLen; - } pszDup = ( char * ) hb_xgrab( ulLen + 1 ); memcpy( pszDup, pszText, ulLen ); @@ -234,17 +228,14 @@ HB_EXPORT ULONG hb_strlentrim( const char * pszText ) HB_TRACE(HB_TR_DEBUG, ("hb_strlentrim(%s)", pszText)); while( pszText[ 0 ] == ' ' ) - { ++pszText; - } + while( pszText[ ul] ) - { ++ul; - } + while( ul && pszText[ ul - 1 ] == ' ' ) - { --ul; - } + return ul; } @@ -373,32 +364,28 @@ HB_EXPORT char * hb_xstrcpy( char * szDest, const char * szSrc, ... ) static double hb_numPow10( int nPrecision ) { - static const double s_dPow10[16] = { 1.0, /* 0 */ - 10.0, /* 1 */ - 100.0, /* 2 */ - 1000.0, /* 3 */ - 10000.0, /* 4 */ - 100000.0, /* 5 */ - 1000000.0, /* 6 */ - 10000000.0, /* 7 */ - 100000000.0, /* 8 */ - 1000000000.0, /* 9 */ - 10000000000.0, /* 10 */ - 100000000000.0, /* 11 */ - 1000000000000.0, /* 12 */ - 10000000000000.0, /* 13 */ - 100000000000000.0, /* 14 */ - 1000000000000000.0 }; /* 15 */ + static const double s_dPow10[ 16 ] = { 1.0, /* 0 */ + 10.0, /* 1 */ + 100.0, /* 2 */ + 1000.0, /* 3 */ + 10000.0, /* 4 */ + 100000.0, /* 5 */ + 1000000.0, /* 6 */ + 10000000.0, /* 7 */ + 100000000.0, /* 8 */ + 1000000000.0, /* 9 */ + 10000000000.0, /* 10 */ + 100000000000.0, /* 11 */ + 1000000000000.0, /* 12 */ + 10000000000000.0, /* 13 */ + 100000000000000.0, /* 14 */ + 1000000000000000.0 }; /* 15 */ if( nPrecision < 16 ) { if( nPrecision >= 0 ) - { return s_dPow10[ nPrecision ]; - } else if( nPrecision > -16 ) - { return 1.0 / s_dPow10[ ( unsigned int ) -nPrecision ]; - } } return pow( 10.0, ( double ) nPrecision ); @@ -463,10 +450,9 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) dNum = -dNum; } else - { fNeg = FALSE; - } - iDecR = (int) log10( dNum ); + + iDecR = ( int ) log10( dNum ); iPrec = iDecR + iDec; if( iPrec < -1 ) @@ -481,9 +467,7 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) iPrec = -1; } else - { iPrec -= HB_NUM_PRECISION; - } } if( iDec < 0 ) { @@ -497,9 +481,7 @@ HB_EXPORT double hb_numRound( double dNum, int iDec ) } if( fNeg ) - { doComplete5 = -doComplete5; - } } #else if( dNum < 0.0f ) @@ -550,10 +532,8 @@ HB_EXPORT double hb_numDecConv( double dNum, int iDec ) { if( iDec > 0 ) return hb_numRound( dNum / hb_numPow10( iDec ), iDec ); - else if( iDec < 0 ) return hb_numRound( dNum * hb_numPow10( -iDec ), 0 ); - else return hb_numRound( dNum, 0 ); } @@ -790,14 +770,10 @@ HB_EXPORT char * hb_strncpy( char * pDest, const char * pSource, ULONG ulLen ) pDest[ ulLen ] ='\0'; while( ulLen && ( *pDest++ = *pSource++ ) != '\0' ) - { ulLen--; - } - while(ulLen--) - { + while( ulLen-- ) *pDest++ = '\0'; - } return pBuf; } @@ -822,17 +798,13 @@ HB_EXPORT char * hb_strncat( char * pDest, const char * pSource, ULONG ulLen ) } while( ulLen && ( *pDest++ = *pSource++ ) != '\0' ) - { ulLen--; - } /* if someone will need this then please uncomment the cleaning the rest of buffer. */ /* while(ulLen--) - { *pDest++ = '\0'; - } */ return pBuf; } @@ -861,9 +833,7 @@ HB_EXPORT char * hb_strncpyLower( char * pDest, const char * pSource, ULONG ulLe } while( ulLen-- ) - { *pDest++ = '\0'; - } return pBuf; } @@ -892,9 +862,7 @@ HB_EXPORT char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLe } while( ulLen-- ) - { *pDest++ = '\0'; - } return pBuf; } @@ -915,13 +883,10 @@ HB_EXPORT char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG ulSLen = 0; while( ulSLen < ulLen && pSource[ ulSLen ] ) - { ulSLen++; - } + while( ulSLen && pSource[ ulSLen - 1 ] == ' ') - { ulSLen--; - } pDest[ ulLen ] = '\0'; @@ -936,9 +901,7 @@ HB_EXPORT char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG } while( ulLen-- ) - { *pDest++ = '\0'; - } return pBuf; } @@ -957,13 +920,10 @@ HB_EXPORT char * hb_strncpyTrim( char * pDest, const char * pSource, ULONG ulLen ulSLen = 0; while( ulSLen < ulLen && pSource[ ulSLen ] ) - { ulSLen++; - } + while( ulSLen && pSource[ ulSLen - 1 ] == ' ' ) - { ulSLen--; - } pDest[ ulLen ] ='\0'; @@ -976,9 +936,7 @@ HB_EXPORT char * hb_strncpyTrim( char * pDest, const char * pSource, ULONG ulLen } while( ulLen-- ) - { *pDest++ = '\0'; - } return pBuf; } diff --git a/harbour/source/rtl/chrasc.c b/harbour/source/rtl/chrasc.c index 225f11859f..2aa5dfad89 100644 --- a/harbour/source/rtl/chrasc.c +++ b/harbour/source/rtl/chrasc.c @@ -73,7 +73,7 @@ HB_FUNC( CHR ) szChar[ 1 ] = '\0'; hb_retclen( szChar, 1 ); #else - hb_retclen( hb_szAscii[ hb_parni( 1 ) & 0xff ], 1 ); + hb_retclen( hb_szAscii[ hb_parni( 1 ) & 0xFF ], 1 ); #endif } else diff --git a/harbour/source/rtl/hbi18n.c b/harbour/source/rtl/hbi18n.c index 40e5861619..5af67da691 100644 --- a/harbour/source/rtl/hbi18n.c +++ b/harbour/source/rtl/hbi18n.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * HB_I18N low-level Harbour functions + * __I18N low-level Harbour functions * * Copyright 2008 Viktor Szakats * www - http://www.harbour-project.org diff --git a/harbour/source/rtl/version.c b/harbour/source/rtl/version.c index 0e179542ce..187fd3fe87 100644 --- a/harbour/source/rtl/version.c +++ b/harbour/source/rtl/version.c @@ -97,6 +97,37 @@ HB_FUNC( HB_VERSION ) case HB_VERSION_FLAG_C: hb_retc_const( hb_verFlagsC() ); break; case HB_VERSION_FLAG_LINKER: hb_retc_const( hb_verFlagsL() ); break; case HB_VERSION_BITWIDTH: hb_retni( ( int ) sizeof( void * ) * 8 ); break; + case HB_VERSION_MT: hb_retl( hb_vmIsMt() ); + + case HB_VERSION_UNIX_COMPAT: + #if defined( HB_OS_UNIX_COMPATIBLE ) + hb_retl( TRUE ); + #else + hb_retl( FALSE ); + #endif + break; + + case HB_VERSION_PLATFORM: + #if defined( HB_OS_DOS ) + hb_retc_const( "DOS" ); + #elif defined( HB_OS_OS2 ) + hb_retc_const( "OS2" ); + #elif defined( HB_OS_WIN_32 ) + hb_retc_const( "WINDOWS" ); + #elif defined( HB_OS_LINUX ) + hb_retc_const( "LINUX" ); + #elif defined( HB_OS_SUNOS ) + hb_retc_const( "SUNOS" ); + #elif defined( HB_OS_HPUX ) + hb_retc_const( "HPUX" ); + #elif defined( HB_OS_DARWIN ) + hb_retc_const( "DARWIN" ); + #elif defined( HB_OS_BSD ) + hb_retc_const( "BSD" ); + #else + hb_retc_null(); + #endif + break; case HB_VERSION_ENDIANNESS: #if defined( HB_LITTLE_ENDIAN ) @@ -112,6 +143,16 @@ HB_FUNC( HB_VERSION ) } } +HB_FUNC( HB_OSISWINNT ) +{ + hb_retl( hb_iswinnt() ); +} + +HB_FUNC( HB_OSISWINCE ) +{ + hb_retl( hb_iswince() ); +} + /* Legacy functions */ HB_FUNC( HB_COMPILER ) diff --git a/harbour/source/vm/itemapi.c b/harbour/source/vm/itemapi.c index ca30de92a2..8689d268dd 100644 --- a/harbour/source/vm/itemapi.c +++ b/harbour/source/vm/itemapi.c @@ -229,7 +229,7 @@ HB_EXPORT PHB_ITEM hb_itemPutC( PHB_ITEM pItem, const char * szText ) else { ulAlloc = 0; - szText = ( char * ) ( ulLen ? hb_szAscii[ ( unsigned char ) ( szText[0] ) ] : "" ); + szText = ( char * ) ( ulLen ? hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ] : "" ); } if( pItem ) @@ -263,7 +263,7 @@ HB_EXPORT PHB_ITEM hb_itemPutCL( PHB_ITEM pItem, const char * szText, ULONG ulLe else { ulAlloc = 0; - szText = ( char * ) ( ulLen ? hb_szAscii[ ( unsigned char ) ( szText[0] ) ] : "" ); + szText = ( char * ) ( ulLen ? hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ] : "" ); } if( pItem ) @@ -374,7 +374,7 @@ HB_EXPORT PHB_ITEM hb_itemPutCPtr2( PHB_ITEM pItem, char * szText ) else if( ulLen == 1 ) { pItem->item.asString.allocated = 0; - pItem->item.asString.value = ( char * ) hb_szAscii[ (unsigned char) ( szText[0] ) ]; + pItem->item.asString.value = ( char * ) hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ]; hb_xfree( szText ); } else @@ -415,7 +415,7 @@ HB_EXPORT PHB_ITEM hb_itemPutCLPtr( PHB_ITEM pItem, char * szText, ULONG ulLen ) else if( ulLen == 1 ) { pItem->item.asString.allocated = 0; - pItem->item.asString.value = ( char * ) hb_szAscii[ (unsigned char) ( szText[0] ) ]; + pItem->item.asString.value = ( char * ) hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ]; hb_xfree( szText ); } else @@ -2313,7 +2313,7 @@ HB_EXPORT BOOL hb_itemStrBuf( char *szResult, PHB_ITEM pNumber, int iSize, int i lNumber = pNumber->item.asDate.value; else if( HB_IS_STRING( pNumber ) ) - lNumber = pNumber->item.asString.value[0]; + lNumber = pNumber->item.asString.value[ 0 ]; else { @@ -2495,7 +2495,7 @@ HB_EXPORT char * hb_itemString( PHB_ITEM pItem, ULONG * ulLen, BOOL * bFreeReq ) buffer = ( char * ) hb_xgrab( size ); do { - n = hb_snprintf( buffer, size, "%p", hb_itemGetPtr( pItem ) ); + n = snprintf( buffer, size, "%p", hb_itemGetPtr( pItem ) ); if( (n > -1) && (n < size) ) { bFail = FALSE;