From 2b78d2754b58abb1b5ed6f97e94924d7dec5b987 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 17 Feb 2011 09:29:13 +0000 Subject: [PATCH] 2011-02-17 10:28 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/hbrandom.c ! Typo in comment. [Tamas] + Enabled using DBL_EPSILON in hb_random_num() on Windows platform, except bcc, which - according to the comment from original author - has some problems with this value. * package/harb_win.rc * contrib/hbrun/hbrun.rc * Modified manifest inclusion to be friendly with all Windows compilers (ie. not break them with their own headers and predefined macro definitions). --- harbour/ChangeLog | 23 ++++++++++++++++++----- harbour/contrib/hbrun/hbrun.rc | 4 +--- harbour/package/harb_win.rc | 13 +++++-------- harbour/src/rtl/hbrandom.c | 11 ++++------- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6a829892ab..fa77deb27c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,16 +16,29 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-17 10:28 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/hbrandom.c + ! Typo in comment. [Tamas] + + Enabled using DBL_EPSILON in hb_random_num() on Windows + platform, except bcc, which - according to the comment + from original author - has some problems with this value. + + * package/harb_win.rc + * contrib/hbrun/hbrun.rc + * Modified manifest inclusion to be friendly with all Windows + compilers (ie. not break them with their own headers and + predefined macro definitions). + 2011-02-16 18:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/qth/QTableWidget.qth * contrib/hbqt/qtgui/qth/QTreeWidget.qth * contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth - + Added: [*A=1*] token to methods where ownership is + + Added: [*A=1*] token to methods where ownership is returned back to HVM from Qt object. * contrib/hbqt/hbmk2_qt.hbs - + Implemented: protocol to transfer the ownership to free - a Qt object to HVM. - TODO: spot methods in all .qth files where ownership + + Implemented: protocol to transfer the ownership to free + a Qt object to HVM. + TODO: spot methods in all .qth files where ownership is switched to application instead of its parent. Speak-out if you find one. @@ -34,7 +47,7 @@ ! Fix: optional parameter was not properly laid. * contrib/hbide/idedocwriter.prg * contrib/hbide/ideharbourhelp.prg - + Implemented: Harbour's core API functions to manage + + Implemented: Harbour's core API functions to manage Documents retrieval and storage. 2011-02-17 00:53 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) diff --git a/harbour/contrib/hbrun/hbrun.rc b/harbour/contrib/hbrun/hbrun.rc index 61bf1cb7ee..5736f30121 100644 --- a/harbour/contrib/hbrun/hbrun.rc +++ b/harbour/contrib/hbrun/hbrun.rc @@ -6,8 +6,6 @@ ICON 1 DISCARDABLE "../../package/harb_os2.ico" #else 1 ICON DISCARDABLE "../../package/harb_win.ico" -#if defined( __MINGW32__ ) || defined( __BORLANDC__ ) || defined( _MSC_VER ) #include "../../package/harb_win.rc" -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "../../package/harb_win.mft" -#endif +__HB_CREATEPROCESS_MANIFEST_RESOURCE_ID __HB_RT_MANIFEST "../../package/harb_win.mft" #endif diff --git a/harbour/package/harb_win.rc b/harbour/package/harb_win.rc index 4d89a8b382..4252aa8036 100644 --- a/harbour/package/harb_win.rc +++ b/harbour/package/harb_win.rc @@ -57,11 +57,8 @@ END /* Preparation for manifest */ -#include - -#ifndef RT_MANIFEST -#define RT_MANIFEST 24 -#endif -#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID -#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 -#endif +/* Not using predefined Windows macros here, because some C compilers + with fail badly with their own definitions (f.e. pocc) and/or their own + Windows headers. [vszakats] */ +#define __HB_CREATEPROCESS_MANIFEST_RESOURCE_ID 1 +#define __HB_RT_MANIFEST 24 diff --git a/harbour/src/rtl/hbrandom.c b/harbour/src/rtl/hbrandom.c index e3e5ab811d..b3c8a62771 100644 --- a/harbour/src/rtl/hbrandom.c +++ b/harbour/src/rtl/hbrandom.c @@ -54,9 +54,7 @@ #include "hbdate.h" #include -#if !defined( HB_OS_WIN ) /* for DBL_EPSILON */ - #include -#endif +#include /* Globally available data, no need to MT it */ static volatile int s_fInit = 0; @@ -95,7 +93,7 @@ HB_FUNC( HB_RANDOM ) * * HB_RANDOMINT() --> returns 0 or 1, evenly distributed * HB_RANDOMINT( N ) --> returns an integer between 1 and N (inclusive) - * HB_RANDOMINT( x, y ) --> Returns a real number between x and y (inclusive) + * HB_RANDOMINT( x, y ) --> Returns an integer number between x and y (inclusive) * The integer returned is of the longest type available */ HB_FUNC( HB_RANDOMINT ) @@ -131,7 +129,7 @@ double hb_random_num() { double d1, d2; - if( !s_fInit ) + if( ! s_fInit ) { srand( ( unsigned ) hb_dateMilliSeconds() ); s_fInit = HB_TRUE; @@ -139,8 +137,7 @@ double hb_random_num() d1 = ( double ) rand(); d2 = ( double ) RAND_MAX; -#if defined( HB_OS_WIN ) - /* TOFIX: it breaks the range of random values */ +#if defined( __BORLANDC__ ) /* It seems that on Windows platform there some weirdness about EPSILON value so that a float division using an epsilon smaller than 1e-10 may be rounded. Must dig if it's a borland lib bug or a windows problem.