Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Fri Dec 07, 2007 12:17 am   

[2.15] String list, local variables parsing error
 
I have been trying to seperate this completely down to the problem and now I am at a loss. In trying to isolate it I now get a parsing error with an AV as the cause of the parsing error. I started tracing this because one of my new functions returned null when it should have gotten a value. It turns out that a local variable RExit was not properly getting set to the return from a lower function. The parsing error did not show up when I was trying to trace this with my existing package, so it looks like there is a problem with where the local variable is defined.

Procedure, I can't even be sure what causes what with this.
1. Launch CMud
2. Close Sessions window (ESC)
3. Open Package Editor (CTRL-G)
4. Right-click in tree panel of PE and paste
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="DirConvertS" type="StringList">
    <value>#IF ($dir="") {
 #SHOW Error in DirConvertS: null direction passed
 #RETURN ""
}
$Res=""
#FORALL $dir {
 #IF (%len(%i)=1) {
  #ADDITEM $Res {%exec(%concat(%pref(iMoveChar),%i))}
 } {
  #ADDITEM $Res {%i}
 }
}
#RESULT $Res</value>
    <arglist>$dir</arglist>
    <notes>Usage @DirConvertS(list:directionChars)
Returns list of directions (ie n|h|j returns as n|nw|ne)</notes>
  </func>
</cmud>

5. Open the EnglishDirections.pkg using the PE
6. Paste into the command line
Code:
#ADDKEY test {1="h|j|k"|2="n|w|s"|3=k|4="u|j|l"}
#SHOW @DirConvertS("l|h|n|u")
#SHOW @DirConvertS(%db(@test,"3")
#LOCAL $RExit
#FORALL "1|2|3|4" {
 #SHOW %i
 #IF (1) {
  $RExit=@DirConvertS(%db(@test,%i))
  #SHOW exit %db(@test,%i) '$RExit'
 }
 #SHOW $RExit
}
Notice that the second line displayed. The third #SHOW, which should have displayed 1 seems to have never displayed and instead the subsequent shows ended up back on the previous line. I can't for the life of me seperate this out from the rest of the mess. Also you will see it doesn't seem like it did the loop.
7. Paste into the command line
Code:
#LOCAL $RExit
#FORALL "1|2|3|4" {
 #SHOW %i
 #IF (1) {
  $RExit=@DirConvertS(%db(@test,%i))
  #SHOW exit %db(@test,%i) '$RExit'
 }
 #SHOW $RExit
}
This will bring up the parsing error. That seems to really be the cause of all the trouble, but I am just guessing about that.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Fri Dec 07, 2007 12:29 am   
 
Sure it isn't related to the problem with stringlist caching that I don't think is resolved?
http://forums.zuggsoft.com/forums/viewtopic.php?t=29055
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Fri Dec 07, 2007 1:35 am   
 
I actually can't be sure of anything with this bug. I think there are at least 3 different bugs occurring with the snippets I posted, because of the different failures I see. I can not reduce it to a point to isolate those failures individually though.

I did make an effort in designing the test procedure to assure that there are no lists that are possibly the same. I don't actually see any way it could trip over the hash table caching bug you found to still be around.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Dec 07, 2007 5:27 pm   
 
I found the problem. It was related to how CMUD was not handling parsing errors properly. In your step (6), you have a parsing error:
Code:
#SHOW @DirConvertS(%db(@test,"3")

and this error was causing all of the subsequent problems.

Now, there was also a problem with the result of @DirConvertS not getting stored into the local variable properly. So you were correct that there were several problems masking each other in this. They should all be fixed in v2.16.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net