#65300 - 2002-05-08 04:39 AM
UDF/Boolean Thingy
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Shawn, are you going to follow-up with Ruud?
|
|
Top
|
|
|
|
#65302 - 2002-05-08 05:12 AM
Re: UDF/Boolean Thingy
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I think that a test scenario needs to be built where a UDF returns all var types to see which ones cause the unexpected behavior. I am attempting to build it now.
|
|
Top
|
|
|
|
#65304 - 2002-05-08 06:07 AM
Re: UDF/Boolean Thingy
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I have been playing with the following script in an attempt to generate the various var types, but do not know how or just can't make them exist.
I did notice that when the UDF is used as an "expression" to be displayed with types Object or Variant a script error occurred.
When it is a Boolean, @Error is set to zero.
All of this can be avoided if all UDF's that return a value send that value to a variable.
There seems to be a bug or deficiency when non-(string or numeric long) var types are treated as "expression" when coming out of a UDF.
If you can fix the code below to generate more VarTypes, the output may be interesting.
code:
Function UDFthingy($i) Dim $i, $var
Select case $i=0 $UDFthingy = $var ;Empty $z=1 case $i=1 $UDFthingy = "" ;Null $z=1 ;case $i=2 ; $UDFthingy = 1 ;Integer ; $z=1 case $i=3 $UDFthingy = 11111111 ;Long Integer $z=1 case $i=4 $UDFthingy = 1.1 ;Single-Prec $z=1 ;case $i=5 ; $UDFthingy = ;Double-Prec ; $z=1 ;case $i=6 ; $UDFthingy = ;Currency ; $z=1 ;case $i=7 ; $UDFthingy = ;Date ; $z=1 case $i=8 $UDFthingy = "Some Text" ;String $z=1 case $i=9 $UDFthingy = GetObject("WinNT://@wksta/Administrator,user") ;Object Handle $z=1 ;Reason: Script error : Error in expression: Dispatch pointers not allowed in expressions. ! case $i=10 $UDFthingy = 1/0 ;Error $z=1 case $i=11 $UDFthingy = exist("blah") ;Boolean $z=1 ;case $i=12 ; $UDFthingy = ;Variant ; $z=1 ;case $i=13 ; $UDFthingy = ;Data-access obj ; $z=1 ;case $i=14 ; $UDFthingy = ;Byte ; $z=1 case $i=15 $UDFthingy = "q",1,"a" ;Array $z=1 Endselect
if $z=1 ? ? "Test #" + $i ? "VarType=" + VarType($UDFthingy) + " " + VarTypeName($UDFthingy) ? exit 2 endif Endfunction
for $x=0 to 15 ;$rc = UDFthingy($x) UDFthingy($x) if $z=1 ? if @error=0 color r+/n "ERROR: " color w/n endif "@@Error=@error" endif $z=0 next
[ 08 May 2002, 16:05: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#65305 - 2002-05-08 09:43 PM
Re: UDF/Boolean Thingy
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#65306 - 2002-05-08 11:37 PM
Re: UDF/Boolean Thingy
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Howard, I'm timing-out here with things - will check-out your script this evening (we're both night-owls eh?) ... by the way, I really appreciate your help on this one - this bug is slippery ... will post to this spot later
-Shawn
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 781 anonymous users online.
|
|
|