Page 1 of 1 1
Topic Options
#180850 - 2007-09-26 11:30 AM Possible Recursive Function Bug in 4.60 RC1
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
I believe there is an issue with KiX v4.60 RC1. Let me explain the problem.

I have a function called JustifyText. Given a 'string', 'length' and a 'justification' parameter it is able to left-justify, right-justify or centre the given 'string'.

If I execute this script against KiX version 4.53 and 4.60 RC1 then I get two different results. To reproduce this issue you may use the sample code below.

 Code:
? "KiX Version: " + @KIX

? @CRLF + ":" + JustifyText("mystring", 12, "left", " ") + ":"


Function JustifyText($String, $StrLength, Optional $Justification, Optional $Delim)
	;This function either centres, right or left justifies given text...default is left justification
	
	;When debugging, please un-comment the following line...
	;? "String: '" + $String + "'"
	
	If $Delim = ""
		$Delim = " "
	Else
		$Delim = Left($Delim, 1)
	EndIf
	
	If Len($String) < $StrLength
		Select
		Case $Justification = "right"
			$JustifyText = JustifyText($Delim + $String, $StrLength, $Justification, $Delim)
		Case $Justification = "centre"
			$JustifyText = JustifyText($String, $StrLength - (($StrLength - Len($String)) / 2), "right", $Delim)
			$JustifyText = JustifyText($JustifyText, $StrLength, "left", $Delim)
		Case 1
			$JustifyText = JustifyText($String + $Delim, $StrLength, $Justification, $Delim)
		EndSelect
	Else
		$JustifyText = $String
	EndIf
EndFunction


If you un-comment the debugging code I have placed into my script then it appears that the function is executing correctly. It's just the final value that is returned to the calling script which is incorrect.

The two different results returned by the above sample script are...

 Code:
C:\>KIX32-453.EXE test.kix
 
KiX Version: 4.53
:mystring    :
C:\>KIX32.EXE test.kix
 
KiX Version: 4.60 Release Candidate 1
:m:
C:\>


Regards,

Lee

Top
#180854 - 2007-09-26 02:35 PM Re: Possible Recursive Function Bug in 4.60 RC1 [Re: Lee Wilmott]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
See http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=180123#Post180123

I think you've found the same bug.
_________________________
(... better days ahead)

Top
#180947 - 2007-09-28 11:41 AM Re: Possible Recursive Function Bug in 4.60 RC1 [Re: Allen]
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Confirmed: this is a bug and I will send out a fixed build asap.

Ruud

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1447 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.051 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.