diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 78d3e7ca6c..e03eaa9476 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,30 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2003-05-26 15:50 UTC+0200 Przemyslaw Czerpak + * harbour/source/rtl/cdpapi.c + * small correction in s_en_codepage = { ... } + + + harbour/source/codepage/cdpplwin.c + * harbour/source/codepage/Makefile + + new Polish codepage PLWIN - CP1250 based + + * harbour/source/rtl/gt.c + + new .prg function HB_GT_VERSION() which returns GT name. + + * harbour/source/rtl/seconds.c + + new function added SECONDSCPU(n) which reports how many CPU and/or + system seconds have elapsed since the beginning of the program execution. + n == 1 utime -> user CPU time of the current process + n == 2 stime -> system CPU time behalf of the current process + n == 3 u + s -> sum of utime + stime (default) + n == 11 cutime -> sum of the user CPU time of the current + child process + n == 12 cstime -> sum of the system CPU time of the current + child process + n == 13 cu+cs -> sum of cutime + cstime + I have to ask someone similar with Windows to add support for this + function. I found 'GetProcessTimes' in WIN API which can be used for + NT based platforms but I cannot find anything for WIN 9X/ME. + 2003-05-22 23:45 UTC-0400 David G. Holm * contrib/rdd_ads/ads1.c * contrib/rdd_ads/adsfunc.c diff --git a/harbour/source/codepage/Makefile b/harbour/source/codepage/Makefile index c958fb65c4..aecb7b02d6 100644 --- a/harbour/source/codepage/Makefile +++ b/harbour/source/codepage/Makefile @@ -5,18 +5,19 @@ ROOT = ../../ C_SOURCES=\ - cdpesdos.c \ - cdpeswin.c \ - cdpgedos.c \ + cdpesdos.c \ + cdpeswin.c \ + cdpgedos.c \ cdpgewin.c \ cdpla850.c \ cdppl852.c \ cdppliso.c \ cdpplmaz.c \ + cdpplwin.c \ cdpru866.c \ cdprukoi.c \ cdpruwin.c LIBNAME=codepage -include $(TOP)$(ROOT)config/lib.cf \ No newline at end of file +include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/source/codepage/cdpplwin.c b/harbour/source/codepage/cdpplwin.c new file mode 100644 index 0000000000..412fb9b119 --- /dev/null +++ b/harbour/source/codepage/cdpplwin.c @@ -0,0 +1,99 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * National Collation Support Module ( PLWIN ) + * + * Copyright 2002 Alexander S.Kresin + * www - http://www.harbour-project.org + * Polish collating sequence (PLWIN) done by Przemyslaw Czerpak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Polish */ +/* ISO language code (2 chars): PL */ +/* Codepage: WIN */ + +#include +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARACTERS 35 /* The number of single characters in the + alphabet, two-as-one aren't considered + here, accented - are considered. */ +#define IS_LATIN 1 /* Should be 1, if the national alphabet + is based on Latin */ +#define ACCENTED_EQUAL 0 /* Should be 1, if accented character + has the same weight as appropriate + unaccented. */ +#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters + sort after their unaccented counterparts + only if the unaccented versions of all + characters being compared are the same + ( interleaving ) */ + +/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the + accented characters with the symbol '~' before each of them, for example: + a~€ + If there is two-character sequence, which is considered as one, it should + be marked with '.' before and after it, for example: + ... h.ch.i ... + + The Upper case string and the Lower case string should be absolutely the + same excepting the characters case, of course. + */ + +static HB_CODEPAGE s_codepage = { "PLWIN",NUMBER_OF_CHARACTERS, + "A¥BCÆDEÊFGHIJKL£MNÑOÓPQRSŒTUVWXYZ¯","a¹bcædeêfghijkl³mnñoópqrsœtuvwxyzŸ¿", + IS_LATIN,ACCENTED_EQUAL,ACCENTED_INTERLEAVED,0,NULL,NULL,NULL,NULL,0,NULL }; + +HB_CODEPAGE_ANNOUNCE( PLWIN ); + +HB_CALL_ON_STARTUP_BEGIN( hb_codepage_Init_PLWIN ) + hb_cdpRegister( &s_codepage ); +HB_CALL_ON_STARTUP_END( hb_codepage_Init_PLWIN ) +#if ! defined(__GNUC__) && ! defined(_MSC_VER) + #pragma startup hb_codepage_Init_PLWIN +#endif + diff --git a/harbour/source/rtl/cdpapi.c b/harbour/source/rtl/cdpapi.c index ddf99f89e4..4313f1d99a 100644 --- a/harbour/source/rtl/cdpapi.c +++ b/harbour/source/rtl/cdpapi.c @@ -55,7 +55,7 @@ #define HB_CDP_MAX_ 64 -static HB_CODEPAGE s_en_codepage = { "EN",0,NULL,NULL,0,0,0,NULL,NULL,NULL,NULL,0,NULL }; +static HB_CODEPAGE s_en_codepage = { "EN",0,NULL,NULL,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL }; static PHB_CODEPAGE s_cdpList[ HB_CDP_MAX_ ]; PHB_CODEPAGE s_cdpage = &s_en_codepage; diff --git a/harbour/source/rtl/gt.c b/harbour/source/rtl/gt.c index 93be26565f..d2076b75f2 100644 --- a/harbour/source/rtl/gt.c +++ b/harbour/source/rtl/gt.c @@ -68,3 +68,11 @@ HB_FUNC( DISPCOUNT ) hb_retni( hb_gtDispCount() ); } +#ifdef HB_EXTENSION + +HB_FUNC( HB_GT_VERSION ) +{ + hb_retc( hb_gt_Version() ); +} + +#endif diff --git a/harbour/source/rtl/seconds.c b/harbour/source/rtl/seconds.c index 1d520680ef..c231589a56 100644 --- a/harbour/source/rtl/seconds.c +++ b/harbour/source/rtl/seconds.c @@ -55,8 +55,12 @@ #include #if defined( HB_OS_BSD) #include + #include + #include #elif defined( OS_UNIX_COMPATIBLE ) #include + #include + #include #else #include #endif @@ -97,6 +101,61 @@ double hb_dateSeconds( void ) ( ( double ) fraction / 1000.0 ); } +#ifdef HB_EXTENSION + +/* + secondsCPU(n) -> nTime + FlagShip/CLIP compatible function, which reports how many CPU and/or + system seconds have elapsed since the beginning of the program execution. + n == 1 utime -> user CPU time of the current process + n == 2 stime -> system CPU time behalf of the current process + n == 3 u + s -> sum of utime + stime (default) + n == 11 cutime -> sum of the user CPU time of the current + child process + n == 12 cstime -> sum of the system CPU time of the current + child process + n == 13 cu+cs -> sum of cutime + cstime +*/ +double hb_secondsCPU(int n) +{ + double d = 0; + +#if defined( OS_UNIX_COMPATIBLE ) + struct tms tm; + + times(&tm); + + if ((n < 1 || n > 3) && (n < 11 || n > 13)) + n = 3; + + if (n > 10) + { + n -= 10; + if (n & 1) + d += tm.tms_cutime; + if (n & 2) + d += tm.tms_cstime; + } + if (n & 1) + d += tm.tms_utime; + if (n & 2) + d += tm.tms_stime; + + d /= (double) sysconf(_SC_CLK_TCK); +#else + /* TODO: this code is only for DOS and other platforms which cannot + calculate process time */ + + if ((n < 1 || n > 3) && (n < 11 || n > 13)) + n = 3; + else if (n > 10) + n -= 10; + if (n & 1) + d = hb_dateSeconds( ); +#endif + return d; +} + +#endif + HB_FUNC( SECONDS ) { hb_retnd( hb_dateSeconds() ); @@ -104,18 +163,14 @@ HB_FUNC( SECONDS ) #ifdef HB_EXTENSION +HB_FUNC( SECONDSCPU ) +{ + hb_retnd( hb_secondsCPU( hb_parni( 1 ) ) ); +} + HB_FUNC( HB_CLOCKS2SECS ) { hb_retnd((double) hb_parnl( 1 ) / CLOCKS_PER_SEC ); } #endif - - - - - - - - -