diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8737b4c9bf..175ec6d037 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-06-02 20:53 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbsetup.h + + added HB_RESTRICT macro which can be used in some declarations + to reach better code optimization + + * harbour/include/hbclass.ch + + added support for xbase++ compatible method declaration by: + METHOD [ , ] + + * harbour/source/rtl/tthreadx.prg + * redirect parameters passed to ::new() method to ::init() method + as emulation for class object new method + + added basic support for ::setInterval in xbasee++ THREAD class + + * harbour/tests/speedtst.prg + ! removed unused variable cDir + 2009-06-02 19:22 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/xhb/Makefile + contrib/xhb/bkgtsks.c diff --git a/harbour/include/hbclass.ch b/harbour/include/hbclass.ch index d77985ea91..f78c116934 100644 --- a/harbour/include/hbclass.ch +++ b/harbour/include/hbclass.ch @@ -571,6 +571,9 @@ DECLARE HBClass ; #xcommand SYNC METHOD [] => METHOD [] SYNC #xcommand SYNC CLASS METHOD [] => CLASSMETHOD [] SYNC + #xcommand METHOD , [, ] => ; + METHOD [ ; METHOD ] [ ; METHOD ] + #xcommand METHOD :[([])] => ; METHOD ( ) CLASS diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 14cc48a81f..6d9ad284e8 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -525,6 +525,7 @@ # else #define HB_ALLOC_SIZE_ATTR( _nParam ) # endif + #define HB_RESTRICT __restrict #else #define HB_PRINTF_FORMAT( _nStr, _nParam ) #define HB_MALLOC_ATTR @@ -533,6 +534,7 @@ #define HB_COLD_ATTR #define HB_FLATTEN_ATTR #define HB_ALLOC_SIZE_ATTR( _nParam ) + #define HB_RESTRICT #endif diff --git a/harbour/source/rtl/tthreadx.prg b/harbour/source/rtl/tthreadx.prg index e619f11041..f9308bae94 100644 --- a/harbour/source/rtl/tthreadx.prg +++ b/harbour/source/rtl/tthreadx.prg @@ -122,9 +122,8 @@ PROTECTED: HIDDEN: VAR pThreadID AS USUAL INIT NIL SYNC - EXPORTED: - METHOD new( nMaxStackSize ) + METHOD new() PROTECTED: /* METHOD atEnd() */ @@ -145,11 +144,16 @@ EXPORTED: ENDCLASS -METHOD new( nMaxStackSize ) CLASS TTHREAD - IF ISNUMBER( nMaxStackSize ) - ::maxStackSize := nMaxStackSize +METHOD new( ... ) CLASS TTHREAD + LOCAL nMaxStackSize + + IF PCount() == 1 + nMaxStackSize := hb_PValue( 1 ) + IF ISNUMBER( nMaxStackSize ) + ::maxStackSize := nMaxStackSize + ENDIF ENDIF - ::Init() + ::Init( ... ) RETURN Self METHOD execute() CLASS TTHREAD @@ -204,25 +208,38 @@ METHOD start( xAction, ... ) CLASS TTHREAD ::active := .T. ::pThreadID := hb_threadStart( HB_THREAD_INHERIT_PUBLIC, ; { |...| - ::startTime := Seconds() - ThreadObject( Self ) - ::result := ::execute( ... ) + WHILE .T. + ::startTime := Seconds() + ThreadObject( Self ) + ::result := ::execute( ... ) + IF ISNUMBER( ::interval ) + hb_idleSleep( ::interval / 100 ) + LOOP + ENDIF + ::startTime := NIL + ENDDO RETURN NIL }, ... ) - ELSEIF !Empty( xAction ) .AND. ValType( xAction ) $ "CBP" + ELSEIF !Empty( xAction ) .AND. ValType( xAction ) $ "CBS" ::active := .T. ::pThreadID := hb_threadStart( HB_THREAD_INHERIT_PUBLIC, ; { |...| - ::startTime := Seconds() - ThreadObject( Self ) - IF ::atStart != NIL - EVAL( ::atStart, ... ) - ENDIF - ::result := DO( xAction, ... ) - IF ::atEnd != NIL - EVAL( ::atEnd, ... ) - ENDIF - ::startTime := NIL + WHILE .T. + ::startTime := Seconds() + ThreadObject( Self ) + IF ::atStart != NIL + EVAL( ::atStart, ... ) + ENDIF + ::result := DO( xAction, ... ) + IF ::atEnd != NIL + EVAL( ::atEnd, ... ) + ENDIF + ::startTime := NIL + IF ISNUMBER( ::interval ) + hb_idleSleep( ::interval / 100 ) + LOOP + ENDIF + ENDDO RETURN NIL }, ... ) ELSE diff --git a/harbour/tests/speedtst.prg b/harbour/tests/speedtst.prg index 59a54fc719..cf5d1fa354 100644 --- a/harbour/tests/speedtst.prg +++ b/harbour/tests/speedtst.prg @@ -255,7 +255,7 @@ STATIC FUNCTION spd_logfile() #ifndef __HARBOUR__ RETURN "speedtst.txt" #else - LOCAL cDir, cName + LOCAL cName hb_FNameSplit( hb_ArgV( 0 ),, @cName ) RETURN hb_FNameMerge( , cName, ".txt" ) #endif