2012-06-25 12:09 UTC+0200 Viktor Szakats (harbour syenar.net)

* contrib/xhb/decode.prg
  * contrib/xhb/dumpvar.prg
  * contrib/xhb/hbcompat.ch
  * contrib/xhb/regexrpl.prg
    % using HB_IS*() functions.
    * formatting
This commit is contained in:
Viktor Szakats
2012-06-25 10:11:12 +00:00
parent 9ceada7183
commit 072b90b2be
5 changed files with 47 additions and 44 deletions

View File

@@ -16,6 +16,14 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-06-25 12:09 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/xhb/decode.prg
* contrib/xhb/dumpvar.prg
* contrib/xhb/hbcompat.ch
* contrib/xhb/regexrpl.prg
% using HB_IS*() functions.
* formatting
2012-06-23 10:53 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/hbmk2_qt.hb
! Fixed: to handle QList<Q*object> implementation.
@@ -33,20 +41,20 @@
2012-06-22 15:09 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/hbmk2_qt.hb
! Optimized to not add code for constructors which do not
! Optimized to not add code for constructors which do not
have Qt objects. Results can be viewed in QLibraryInfo.cpp.
2012-06-22 12:47 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/hbmk2_qt.hb
* contrib/hbqt/qtcore/hbqt.h
* contrib/hbqt/qtcore/hbqt_init.cpp
- Removed: a hack introduced some months back where
- Removed: a hack introduced some months back where
C++ static items were held in a list them released
at exit of an application. This was double work and
at exit of an application. This was double work and
now is not needed at all.
* contrib/hbqt/qtcore/hbqt_bind.cpp
- Reverted: last fix where <qtObject> was compared against
- Reverted: last fix where <qtObject> was compared against
a numeric, which, BTW was a stupid implementation.
A pointer casted to a numeric is always true.
@@ -55,8 +63,8 @@
It was breaking such code:
oWnd:connect( QEvent_Close, {|| QApplication():quit() } )
QApplication():exec()
the reason was any code executed after
QApplication():quit() was rendered unexcutable because
the reason was any code executed after
QApplication():quit() was rendered unexcutable because
appln was forced to stop execution.
* contrib/hbqt/qtcore/hbqt_hbqevents.cpp
@@ -65,7 +73,7 @@
* contrib/hbqt/qtcore/qth/QLibraryInfo.qth
* contrib/hbqt/qtgui/qth/QDesktopServices.qth
+ Reworked: constructors.
+ Reworked: constructors.
Previous implementation was wrong.
Applied Francesco's thought and it worked, thanks.

View File

@@ -119,18 +119,18 @@ FUNCTION HB_Decode(...)
// Ok because I have no other value than default, I will check if it is a complex value
// like an array or an hash, so I can get it to decode values
IF xDefault != NIL .AND. ;
( ValType( xDefault ) == "A" .OR. ;
ValType( xDefault ) == "H" )
( HB_ISARRAY( xDefault ) .OR. ;
HB_ISHASH( xDefault ) )
// If it is an array I will restart this function creating a linear call
IF ValType( xDefault ) == "A" .AND. Len( xDefault ) > 0
IF HB_ISARRAY( xDefault ) .AND. Len( xDefault ) > 0
// I can have a linear array like { 1, "A", 2, "B", 3, "C" }
// or an array of array couples like { { 1, "A" }, { 2, "B" }, { 3, "C" } }
// first element tell me what type is
// couples of values
IF ValType( xDefault[ 1 ] ) == "A"
IF HB_ISARRAY( xDefault[ 1 ] )
//// If i have an array as default, this contains couples of key / value
//// so I have to convert in a linear array
@@ -139,7 +139,7 @@ FUNCTION HB_Decode(...)
// Check if array has a default value, this will be last value and has a value
// different from an array
IF !( ValType( xDefault[ nLen ] ) == "A" )
IF ! HB_ISARRAY( xDefault[ nLen ] )
aParams := Array( ( nLen - 1 ) * 2 )
@@ -172,7 +172,7 @@ FUNCTION HB_Decode(...)
// If it is an hash, translate it in an array
ELSEIF ValType( xDefault ) == "H"
ELSEIF HB_ISHASH( xDefault )
aParams := Array( Len( xDefault ) * 2 )
@@ -208,7 +208,7 @@ FUNCTION HB_Decode(...)
// Check if value exists (valtype of values MUST be same of xVal,
// otherwise I will get a runtime error)
// TODO: Have I to check also between different valtypes, jumping different ?
nPos := aScan( aValues, {|e| e == xVal } )
nPos := aScan( aValues, {| e | e == xVal } )
IF nPos == 0 // Not Found, returning default
xRet := xDefault // it could be also nil because not present
@@ -242,7 +242,7 @@ STATIC FUNCTION EmptyValue( xVal )
xRet := ""
EXIT
CASE "D" // Date
xRet := CTOD("")
xRet := CTOD( "" )
EXIT
CASE "L" // Logical
xRet := .F.
@@ -257,7 +257,7 @@ STATIC FUNCTION EmptyValue( xVal )
xRet := {}
EXIT
CASE "H" // hash
xRet := {=>}
xRet := { => }
EXIT
CASE "U" // undefined
xRet := NIL

View File

@@ -242,7 +242,7 @@ STATIC FUNCTION DShowHash( hVar, lRecursive, nIndent, nRecursionLevel, nMaxRecur
//TraceLog( "DShowHash: hVar, ValType( hVar ), lRecursive", hVar, ValType( hVar ), ValToPrg( hVar ), lRecursive )
IF ValType( hVar ) == "H"
IF HB_ISHASH( hVar )
nEolLen := Len( hb_eol() )
cString += Space( nIndent ) + "{" + hb_eol()
FOR EACH xVal IN hVar

View File

@@ -153,20 +153,20 @@
#xtranslate hb_mutexNotify(<x,...>) => Notify(<x>)
#xtranslate hb_mutexNotifyAll(<x,...>) => NotifyAll(<x>)
#xtranslate hb_mutexSubscribe(<x,...>) => {|mtx, nTimeOut, xSubscribed| ;;
#xtranslate hb_mutexSubscribe(<x,...>) => {| mtx, nTimeOut, xSubscribed | ;;
local lSubscribed ;;
xSubscribed := Subscribe( mtx, ;
iif( hb_isNumeric( nTimeOut ), nTimeOut * 1000, ), ;
iif( HB_ISNUMERIC( nTimeOut ), nTimeOut * 1000, ), ;
@lSubscribed ) ;
return lSubscribed ; }:eval( <x> )
#xtranslate hb_mutexSubscribeNow(<x,...>) => {|mtx, nTimeOut, xSubscribed| ;;
#xtranslate hb_mutexSubscribeNow(<x,...>) => {| mtx, nTimeOut, xSubscribed | ;;
local lSubscribed ;;
xSubscribed := SubscribeNow( mtx, ;
iif( hb_isNumeric( nTimeOut ), nTimeOut * 1000, ), ;
iif( HB_ISNUMERIC( nTimeOut ), nTimeOut * 1000, ), ;
@lSubscribed ) ;
return lSubscribed ; }:eval( <x> )
#xtranslate hb_MutexLock( <x>, <n> ) => iif( !hb_isNumeric( <n> ), hb_MutexLock( <x> ) ;
#xtranslate hb_MutexLock( <x>, <n> ) => iif( ! HB_ISNUMERIC( <n> ), hb_MutexLock( <x> ) ;
iif( <n> <= 0, hb_MutexTryLock( <x> ), ;
hb_MutexTimeOutLock( <x>, <n> ) ) )
@@ -281,8 +281,8 @@
#xuntranslate NetName( =>
#xuntranslate MemoWrit( =>
#xtranslate NetName(<n>) => iif( hb_isNumeric( <n> ) .AND. <n> == 1, hb_UserName(), NetName() )
#xtranslate MemoWrit(<x>,<y>,<z>) => iif( hb_isLogical(<z>) .AND. ! <z>, hb_MemoWrit(<x>,<y>), MemoWrit(<x>,<y>) )
#xtranslate NetName(<n>) => iif( HB_ISNUMERIC( <n> ) .AND. <n> == 1, hb_UserName(), NetName() )
#xtranslate MemoWrit(<x>,<y>,<z>) => iif( HB_ISLOGICAL( <z> ) .AND. ! <z>, hb_MemoWrit(<x>,<y>), MemoWrit(<x>,<y>) )
#xuntranslate AIns( =>
#xuntranslate ADel( =>
@@ -311,7 +311,7 @@
#xcommand FINALLY => ALWAYS
/* EXTENDED CODEBLOCKs */
#xtranslate \<|[<x,...>]| => {|<x>|
#xtranslate \<|[<x,...>]| => {| <x> |
#xcommand > [<*x*>] => } <x>
/* xHarbour operators: IN, HAS, LIKE, >>, <<, |, &, ^^ */
@@ -421,26 +421,26 @@
#xtranslate DestroyMutex( <x> ) =>
#xtranslate hb_MutexTryLock( <x> ) => hb_mutexLock( <x>, 0 )
#xtranslate hb_MutexTimeOutLock( <x> ) => hb_mutexLock( <x>, 0 )
#xtranslate hb_MutexTimeOutLock( <x>, <n> ) => hb_mutexLock( <x>, IIF( hb_isNumeric( <n> ), <n> / 1000, 0 ) )
#xtranslate hb_MutexTimeOutLock( <x>, <n> ) => hb_mutexLock( <x>, iif( HB_ISNUMERIC( <n> ), <n> / 1000, 0 ) )
#xtranslate Notify( <x,...> ) => hb_mutexNotify( <x> )
#xtranslate NotifyAll( <x,...> ) => hb_mutexNotifyAll( <x> )
#xtranslate Subscribe( <x,...> ) => {|mtx, nTimeOut, lSubscribed| ;;
#xtranslate Subscribe( <x,...> ) => {| mtx, nTimeOut, lSubscribed | ;;
local xSubscribed ;;
lSubscribed := hb_mutexSubscribe( mtx, ;
iif( hb_isNumeric( nTimeOut ), nTimeOut / 1000, ), ;
iif( HB_ISNUMERIC( nTimeOut ), nTimeOut / 1000, ), ;
@xSubscribed ) ;
return xSubscribed ; }:eval( <x> )
#xtranslate SubscribeNow( <x,...> ) => {|mtx, nTimeOut, lSubscribed| ;;
#xtranslate SubscribeNow( <x,...> ) => {| mtx, nTimeOut, lSubscribed | ;;
local xSubscribed ;;
lSubscribed := hb_mutexSubscribeNow( mtx, ;
iif( hb_isNumeric( nTimeOut ), nTimeOut / 1000, ), ;
iif( HB_ISNUMERIC( nTimeOut ), nTimeOut / 1000, ), ;
@xSubscribed ) ;
return xSubscribed ; }:eval( <x> )
#xtranslate StartThread( [<x>] ) => hb_threadStart( <x> )
#xtranslate StartThread( <x>, <y> [, <z,...>] ) => iif( valtype( <x> ) == "O" .and. hb_isString( <y> ), ;
hb_threadStart( {|...| (<x>):&(<y>)( ... ) } [, <z>] ), ;
#xtranslate StartThread( <x>, <y> [, <z,...>] ) => iif( HB_ISOBJECT( <x> ) .AND. HB_ISSTRING( <y> ), ;
hb_threadStart( {| ... | (<x>):&(<y>)( ... ) } [, <z>] ), ;
hb_threadStart( <x>, <y> [, <z>] ) )
/* not possible to well replicate xHarbour behavior because it's buggy
@@ -501,16 +501,16 @@
#xtranslate HAAGETVALUEAT([<x,...>]) => hb_HVALUEAT(<x>)
#xtranslate HAADELAT([<x,...>]) => hb_HDELAT(<x>)
#xtranslate HAAGETPOS([<x,...>]) => hb_HPOS(<x>)
#xtranslate HAAGETREALPOS(<x>,<y>) => iif( hb_isNumeric( <y> ) .AND. <y> >= 1 .AND. ;
#xtranslate HAAGETREALPOS(<x>,<y>) => iif( HB_ISNUMERIC( <y> ) .AND. <y> >= 1 .AND. ;
int( <y> ) <= len( <x> ), int( <y> ), 0 )
#xtranslate HGETVAAPOS(<x>) => {|h| ;;
#xtranslate HGETVAAPOS(<x>) => {| h | ;;
local a := array( len( h ), v ;;
for each v in a ;;
v := v:__enumIndex() ;;
next ;;
return a ; }:eval( <x> )
#xtranslate HGETAACOMPATIBILITY(<x>) => hb_HKEEPORDER(<x>)
#xtranslate HSETAACOMPATIBILITY([<x,...>]) => {|h| ;;
#xtranslate HSETAACOMPATIBILITY([<x,...>]) => {| h | ;;
hb_HKEEPORDER( h ) ;;
return .T. ; }:eval( <x> )

View File

@@ -49,8 +49,6 @@
*
*/
//--------------------------------------------------------------//
#define MATCH_STRING 1
#define MATCH_START 2
#define MATCH_END 3
@@ -61,16 +59,15 @@ FUNCTION hb_RegexReplace( cRegex, cString, cReplace, lCaseSensitive, lNewLine, n
LOCAL cReturn
LOCAL nOffSet := 0
LOCAL cSearch, nStart, nLenSearch, nLenReplace
//LOCAL nEnd
aMatches := HB_RegExAll( cRegEx, cString, lCaseSensitive, lNewLine, nMaxMatches, nGetMatch, .F. )
cReturn := cString
IF ! Empty( aMatches )
FOR EACH aMatch IN aMatches
IF ValType( aMatch ) == "A" .AND. Len( aMatch ) == 1 .AND. ;
ValType( aMatch[1] ) == "A"
aMatch := aMatch[1]
IF HB_ISARRAY( aMatch ) .AND. Len( aMatch ) == 1 .AND. ;
HB_ISARRAY( aMatch[ 1 ] )
aMatch := aMatch[ 1 ]
ENDIF
IF Len( aMatch ) == 3 // if regex matches I must have an array of 3 elements
cSearch := aMatch[ MATCH_STRING ]
@@ -84,6 +81,4 @@ FUNCTION hb_RegexReplace( cRegex, cString, cReplace, lCaseSensitive, lNewLine, n
ENDIF
RETURN cReturn
//--------------------------------------------------------------//
RETURN cReturn