2011-04-15 22:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* include/hbapi.h
  * include/harbour.hbx
  * src/common/hbver.c
  * src/rtl/version.c
    + added hb_verHostBitWidth( void ) -> int which retrieves bit width of host OS
    + added HB_OSBITWIDTH() -> <nBits>
    ; It will currently work on win platform, falling back to target arch bits
      for others. Pls extend it for *nixes. For MS-DOS, 32 will be returned with
      both currently supported compilers.
This commit is contained in:
Viktor Szakats
2011-04-15 20:04:02 +00:00
parent 35e4b9d078
commit 76ea49c864
5 changed files with 60 additions and 2 deletions

View File

@@ -16,18 +16,29 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-04-15 22:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* include/hbapi.h
* include/harbour.hbx
* src/common/hbver.c
* src/rtl/version.c
+ added hb_verHostBitWidth( void ) -> int which retrieves bit width of host OS
+ added HB_OSBITWIDTH() -> <nBits>
; It will currently work on win platform, falling back to target arch bits
for others. Pls extend it for *nixes. For MS-DOS, 32 will be returned with
both currently supported compilers.
2011-04-15 09:59 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbxbp/xbppushbutton.prg
! Fixed: :activate was firing event twice, on press and release, both.
* contrib/hbxbp/xbpwindow.prg
! Fixed: to reset window size as per GUI norms. Xbase++ seems
! Fixed: to reset window size as per GUI norms. Xbase++ seems
wrong on this account where XbpDialog() height is "excluding"
window frame-height whereas width is "inclusing" frame-width.
2011-04-15 01:52 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbxbp/xbpwindow.prg
! Depricated: setting fore/background colors of a part via
! Depricated: setting fore/background colors of a part via
style sheet which was raising some issues. It needs further
rationalization as well for some type of components.

View File

@@ -661,6 +661,7 @@ DYNAMIC HB_NTOS
DYNAMIC HB_NTOT
DYNAMIC HB_NUMTOHEX
DYNAMIC HB_OEMTOANSI
DYNAMIC HB_OSBITWIDTH
DYNAMIC HB_OSDRIVESEPARATOR
DYNAMIC HB_OSERROR
DYNAMIC HB_OSFILEMASK

View File

@@ -1138,6 +1138,7 @@ extern HB_EXPORT void * hb_libSymAddr( PHB_ITEM pDynLib, const char * pszS
extern HB_EXPORT void hb_dynCall( int iFuncFlags, void * pFunction, int iParams, int iFirst, int * piArgFlags );
/* misc */
extern HB_EXPORT int hb_verHostBitWidth( void ); /* retrieves bit width of host OS */
extern HB_EXPORT const char * hb_verCPU( void ); /* retrieves a constant string with CPU architecture */
extern HB_EXPORT const char * hb_verPlatformMacro( void ); /* retrieves a constant string with OS platform (as it appears in __PLATFORM__* macro) */
extern HB_EXPORT char * hb_verPlatform( void ); /* retrieves a newly allocated buffer containing platform version */

View File

@@ -66,6 +66,7 @@
* hb_verPlatform() (support for detecting Windows NT on DOS)
* hb_verPlatform() (rearrangment and cleanup)
* hb_verPlatform() (Wine detection and some more)
* hb_verHostBitWidth()
*
* See COPYING for licensing terms.
*
@@ -151,6 +152,45 @@ const char * hb_verHostCPU( void )
}
#endif
int hb_verHostBitWidth( void )
{
int nBits;
/* Inherit the bit width we're building for */
#if defined( HB_ARCH_64BIT )
nBits = 64;
#elif defined( HB_ARCH_32BIT )
nBits = 32;
#elif defined( HB_ARCH_16BIT )
nBits = 16;
#else
nBits = 0;
#endif
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_64 )
{
typedef BOOL ( WINAPI * P_ISWOW64PROCESS )( HANDLE, PBOOL );
P_ISWOW64PROCESS pIsWow64Process = ( P_ISWOW64PROCESS ) GetProcAddress( GetModuleHandle( TEXT( "kernel32" ) ), "IsWow64Process" );
if( pIsWow64Process )
{
BOOL bIsWow64 = FALSE;
if( ! pIsWow64Process( GetCurrentProcess(), &bIsWow64 ) )
{
/* Try alternative method? */
}
if( bIsWow64 )
nBits = 64;
}
}
#endif
return nBits;
}
/* NOTE: OS() function, as a primary goal will detect the version number
of the target platform. As an extra it may also detect the host OS.
The latter is mainly an issue in DOS, where the host OS can be OS/2

View File

@@ -174,6 +174,11 @@ HB_FUNC( HB_VERSION )
}
}
HB_FUNC( HB_OSBITWIDTH )
{
hb_retni( hb_verHostBitWidth() );
}
HB_FUNC( HB_OSISWIN9X )
{
hb_retl( hb_iswin9x() );