Force interrupt

Jim Ault JimAultWins at yahoo.com
Fri Jan 12 14:09:15 EST 2007


>>> Here's the tough part... I can't know in advance where the running
>>> script is originating. I simply know something is running
>>> somewhere in my stack, and whatever it is, I want to abort it via
>>> script control.
>>> 

The most basic explanation that I have encountered for 'locked' routines is
that you have triggered a repeat loop with a condition that makes it
infinite.  Rev runs code so quickly that it does not 'see' the ctrl period
or escape and halt, at least in my experiences.  Even if it does stop, you
don't know where!  Unfortunately for you, I am such a good programmer that I
never write an infinite loop so have limited experience with this.

You can stop laughing now.  The standard technique for me is to write a
stack or lib handler

on debugAltStop
  if the altKey is down then breakpoint --optKey on Mac
end debugAltStop


repeat while tProcess is not empty
   debugAltStop
   --do my work

end repeat
Now if you drop into 'debugStop" you can step into the handler that is
spinning when you held the altKey down.

You could write a little stack/lib handler in Rev to edit all of your
scripts and add the 'debugStop' line.

--save a backup set of these stacks, then modify them like this.
Rev can edit is own scripts, so you might want to consider that way.

repeat with x = 1 to the number of controls --btns, flds, imgs, gps
 put the script of control x into scriptTemp
if mm is empty then next repeat
repeat for each line LNN in scriptTemp
   put LNN & cr after newScript
  if LNN contains "repeat while"
   then put LNN &cr& " debugAltStop" & cr after newScript
  if LNN contains "repeat until"
   then put LNN &cr& " debugAltStop" & cr after newScript
end repeat

set the script of btn x to "--mod with debugStop"& cr & newScript
end repeat
save this stack

* also the card. stack scripts (back, front if you used them)
After testing and locating the errors, you will fix the backups and put them
into use.

Hope this gives you some ideas about how to find those gremlins.

Jim Ault
Las Vegas






More information about the use-livecode mailing list