MEMVARs, PUBLICs etc.
Posted: Thu May 09, 2019 6:38 am
Hi Robert
i´ve looked at the _Mxxx() memvar funcs and it looks good. The only problem so far is the _MRelease() behaviour.
i had to change the line:
WHILE text != __Symbol{""}
to:
WHILE text != NULL
otherwise the DO .. WHILE is in a endless loop
regards
Karl-Heinz
i´ve looked at the _Mxxx() memvar funcs and it looks good. The only problem so far is the _MRelease() behaviour.
i had to change the line:
WHILE text != __Symbol{""}
to:
WHILE text != NULL
otherwise the DO .. WHILE is in a endless loop
Code: Select all
FUNCTION Start( ) AS VOID
PRIVATE x1, x2,x3
x1 := 1
x2 := 2
x3 := 3
? "Number of PRIVATEs:" , memvar:PrivatesCount() // 3
?
? "private x1 content before _MRelease()" , x1 // 1
? "private x2 content before _MRelease()" , x2 // 2
? "private x3 content before _MRelease()" , x3 // 3
// _MRelease ( "x*" , FALSE ) // ok, doesn´t release any of the privates
_MRelease ( "x*" , TRUE ) // ok, does release x1, x2 and x3
// _MRelease ( "x1" , FALSE ) // ok, does release x2 and x3 only
// _MRelease ( "x1" , TRUE ) // ok, does release x1 only
?
? "private x1 content after _MRelease()" , x1
? "private x2 content after _MRelease()" , x2
? "private x3 content after _MRelease()" , x3
?
? "Number of PRIVATEs before _MClear():" , memvar:PrivatesCount() // 3
?
_MCLEAR() // remove all privates and publics
?
? "Number of PRIVATEs after _MClear():" , memvar:PrivatesCount() // 0
?
RETURN
// overrides the Xsharp.RT _MRelease()
FUNCTION _MRelease(cMask AS STRING , lMatch AS LOGIC ) AS VOID
LOCAL text AS STRING
//
cMask := XSharp.Core.Functions.Upper(cMask)
text := _PrivateFirst(FALSE)
WHILE text != NULL // __Symbol{""} // KHR changed to NULL
IF (XSharp.Core.Functions._Like(cMask, text) == lMatch)
MemVarPut(text, __Usual._NIL)
ENDIF
text := _PrivateNext()
END WHILE
Karl-Heinz