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 <methodName1> [ , <methodNameN> ]

  * 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
This commit is contained in:
Przemyslaw Czerpak
2009-06-02 18:44:21 +00:00
parent 6ef2986f43
commit e3ab3d0b8b
5 changed files with 60 additions and 21 deletions

View File

@@ -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 <methodName1> [ , <methodNameN> ]
* 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

View File

@@ -571,6 +571,9 @@ DECLARE HBClass ;
#xcommand SYNC METHOD <MethodName> [<decl,...>] => METHOD <MethodName> [<decl>] SYNC
#xcommand SYNC CLASS METHOD <MethodName> [<decl,...>] => CLASSMETHOD <MethodName> [<decl>] SYNC
#xcommand METHOD <!MethodName1!>, <!MethodName2!> [, <!MethodNameN!>] => ;
METHOD <MethodName1> [ ; METHOD <MethodName2> ] [ ; METHOD <MethodNameN> ]
#xcommand METHOD <!className!>:<!methodName!>[([<params,...>])] => ;
METHOD <methodName>( <params> ) CLASS <className>

View File

@@ -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

View File

@@ -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

View File

@@ -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