Page 1 of 1 1
Topic Options
#65300 - 2002-05-08 04:39 AM UDF/Boolean Thingy
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Shawn, are you going to follow-up with Ruud?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65301 - 2002-05-08 04:46 AM Re: UDF/Boolean Thingy
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I still can't wrap my mind around exactly what the problem is - can you put words to it and/or provide a simplified demonstration script ?

-Shawn

Top
#65302 - 2002-05-08 05:12 AM Re: UDF/Boolean Thingy
Howard Bullock Offline
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.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65303 - 2002-05-08 05:39 AM Re: UDF/Boolean Thingy
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmm, if you convert the boolean to something like a long with 4.10's CInt() function - it works ok ...

break on

func()

@ERROR

exit 1

function func()
$func = exist("")
; $func = CInt(exist(""))
exit 4
endfunction

-Shawn

Top
#65304 - 2002-05-08 06:07 AM Re: UDF/Boolean Thingy
Howard Bullock Offline
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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65305 - 2002-05-08 09:43 PM Re: UDF/Boolean Thingy
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Shawn, your thoughts?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65306 - 2002-05-08 11:37 PM Re: UDF/Boolean Thingy
Shawn Administrator Offline
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 [Wink]

-Shawn

Top
#65307 - 2002-05-09 03:21 AM Re: UDF/Boolean Thingy
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ok, that OLE one is interesting. I have already sent a note to Ruud about that one. In its simplest form, here it is:

break on

getobject("WinNT://@LDOMAIN/@USERID,User")

exit 1

basically, an unassigned getobject. If you run this code with 4.10 you get a script error. If you run it with 4.02, you get the object address piped to the screen (which is what one would expect). That's the point I argued with Ruud but he said the former is expected (script error). Anyways, he mentioned that he would try and "improve that a bit" ... still looking ...

-Shawn

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 484 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.055 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org