Saturday, October 22, 2016

The python callback wait loop

 Here, this loop is reached from the trace back interrupt.  The code goes here when the run/wait flag is greater tyan zero. It extracts the line number from the frame (not shown).  If the line number changed, then go into the loop after updating watch variables in the watch text window,  by calling BreakHalt.

It only goes into tyhe loop on a line nubmer change, since running the two call backs gets to interrupts per line.  I don't care, they are handled and I sort the difference later.  But, the call back trace function simply waits until the flag is not zero, and exits.  At that pony, the previous call to message loop from main takes over, again.  The root update methods are re-entrant.

TestCode.flag = 0
if TestCode.lineno != TestCode.prevlineno : BreakHalt() 
  while True :
   if TestCode.flag != 0 : 
    break
   TestCode.root.update_idletasks()
   TestCode.root.update()


ANdhere is the run command as triggered in the mainloop called from app star:

  self.flag= 1
 exec(self.sourcetext,self.globals,self.locals)
 self.flag= -2

All of the debug control clicks take place within the exec call, via service interrupts.

No comments: