TMGIDE.m

From VistApedia
Revision as of 16:42, 21 June 2005 by 69.68.182.66 (talk)
Jump to: navigation, search
;"------------------------------------------------------------
;"------------------------------------------------------------
;"
;" GT.M Debug Tracer
;"
;" K. Toppenberg
;" 4-13-2005
;" License: GPL Applies
;"
;"
;" This program will launch a shell for the TMG STEP TRAP debugger
;" It provides the user with a prompt, like this:
;"
;"      (^ to quit) IDE>
;"
;" Any valid M code may be entered here.  To use the tracing
;" ability, launch a function, like this:
;"
;"      (^ to quit) IDE>do ^MyFunction
;"
;"
;" Dependancies:
;"     Uses TMGTRSTP,TMGTERM
;"
;"------------------------------------------------------------
;"------------------------------------------------------------  


Start
      set TMGScrWidth=70
      set TMGScrHeight=10

      do SetGlobals^TMGTERM
      set TMGNlFGColor=TMGcWhite
      set TMGNlBGColor=TMGcBlack
      set TMGDbFGColor=TMGcBlack
      set TMGDbBFColor=TMGcWhite

      set ^TMP("TMGIDE",$J,"Normal Foreground Color")=TMGcBlack
      set ^TMP("TMGIDE",$J,"Normal Background Color")=TMGcWhite
      set ^TMP("TMGIDE",$J,"Debug Foreground Color")=TMGcWhite
      set ^TMP("TMGIDE",$J,"Debug Background Color")=TMGcBlack
 
      for i=1:1:80 write !
      write !,"Welcome to the TMG debugging environment",!
      write "Enter any valid M command...",!
      set $ZTRAP="do ErrTrap^TMGTPSTP($ZPOS) break"
      set $ZSTATUS=""

      do Prompt
Done
      do ShutDown
      quit

;"-------------------------------------------------------------------
Prompt
      new Line
      read !,"(^ to quit) IDE>",Line,!

      if Line="^" set $ZSTEP="" quit
      set $ZSTEP="N TMGTrap S TMGTrap=$$STEPTRAP^TMGTPSTP($ZPOS) zstep:(TMGTrap=1) into zstep:(TMGTrap=2) over zcontinue"
      ;set $ZSTEP="do STEPTRAP^TMGTPSTP($ZPOS) zstep into zcontinue"

      set TMGRunMode=1  ;"1=Step-by-step mode
      zstep into
      xecute Line
      set $ZSTEP=""  ;"turn off step capture
      goto Prompt


ShutDown
      ;"do ShowCode("",80,15,1)
      do KillGlobals^TMGTERM
      kill TMGNlFGColor
      kill TMGNlBGColor
      kill TMGDbFGColor
      kill TMGDbBFColor

      quit

BKPT
       read "Enter breakpoint (e.g. Label+8^MyFunct): ",Pos,!
       set Pos=Pos_":""n tmg s tmg=$$STEPTRAP^TMGTPSTP($ZPOS,1)"""
       ZBREAK @Pos
       write "ZBREAK ",Pos,!

       quit