Author: sebor Date: Mon May 26 12:52:14 2008 New Revision: 660283 URL: http://svn.apache.org/viewvc?rev=660283&view=rev Log: 2008-05-26 Martin Sebor * util/cmdopt.cpp (TICKS_PER_SEC): Moved definition from here... * util/display.cpp: ...to here (the only file where it's used), declared it static, and siplified preprocessor logic around it. * util/cmdopt.h (TICKS_PER_SEC): Removed declaration. Modified: stdcxx/branches/4.2.x/util/cmdopt.cpp stdcxx/branches/4.2.x/util/cmdopt.h stdcxx/branches/4.2.x/util/display.cpp Modified: stdcxx/branches/4.2.x/util/cmdopt.cpp URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/util/cmdopt.cpp?rev=660283&r1=660282&r2=660283&view=diff ============================================================================== --- stdcxx/branches/4.2.x/util/cmdopt.cpp (original) +++ stdcxx/branches/4.2.x/util/cmdopt.cpp Mon May 26 12:52:14 2008 @@ -53,26 +53,20 @@ #include "cmdopt.h" const char* exe_name; /**< Alias for process argv [0]. */ -#if !defined (_WIN32) && !defined (_WIN64) + +#ifndef _WIN32 + const char escape_code = '\\'; const char default_path_sep = '/'; const char suffix_sep = '.'; const size_t exe_suffix_len = 0; -#if defined (_SC_CLK_TCK) -const float TICKS_PER_SEC = float (sysconf (_SC_CLK_TCK)); -#elif defined (CLK_TCK) -const float TICKS_PER_SEC = CLK_TCK; -#elif defined (CLOCKS_PER_SEC) -const float TICKS_PER_SEC = CLOCKS_PER_SEC; -#else -# error Unable to determine number of clock ticks in a second. -#endif -#else + +#else /* Win32 */ + const char escape_code = '^'; const char default_path_sep = '\\'; const char suffix_sep = '.'; const size_t exe_suffix_len = 4; /* strlen(".exe") == 4 */ -const float TICKS_PER_SEC = CLOCKS_PER_SEC; # ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0500 Modified: stdcxx/branches/4.2.x/util/cmdopt.h URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/util/cmdopt.h?rev=660283&r1=660282&r2=660283&view=diff ============================================================================== --- stdcxx/branches/4.2.x/util/cmdopt.h (original) +++ stdcxx/branches/4.2.x/util/cmdopt.h Mon May 26 12:52:14 2008 @@ -34,7 +34,7 @@ extern const char default_path_sep; /**< Primary path seperator */ extern const char suffix_sep; /**< File suffix seperator. */ extern const size_t exe_suffix_len; /**< Length of executable suffix. */ -extern const float TICKS_PER_SEC; /**< Number of clock ticks in a second. */ + /** Parses command line arguments for switches and options. Modified: stdcxx/branches/4.2.x/util/display.cpp URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/util/display.cpp?rev=660283&r1=660282&r2=660283&view=diff ============================================================================== --- stdcxx/branches/4.2.x/util/display.cpp (original) +++ stdcxx/branches/4.2.x/util/display.cpp Mon May 26 12:52:14 2008 @@ -34,6 +34,34 @@ #include "display.h" #include "target.h" /* for target_status */ +#include /* for CLK_TCK, CLOCKS_PER_SEC */ + +#ifndef _WIN32 +# include /* for _SC_CLK_TCK, sysconf() */ +#endif + +#if defined (_SC_CLK_TCK) + +/* dynamically determine the number of clock ticks per second */ +static const float TICKS_PER_SEC = float (sysconf (_SC_CLK_TCK)); + +#elif defined CLOCKS_PER_SEC + +/* use the POSIX (and MSVC 6.0) CLOCKS_PER_SEC constant */ +static const float TICKS_PER_SEC = CLOCKS_PER_SEC; + +#elif defined CLK_TCK + +/* use CLK_TCK if it's defined (e.g., pre-MSVC 6.0) */ +static const float TICKS_PER_SEC = CLK_TCK; + +#else + +/* if all else fails, assume the standard 1 million ticks per second */ +static const float TICKS_PER_SEC = 1000000UL; + +#endif + /** ProcessStatus enum lookup table for 'short' (6 character) strings.