TMGIDE.m: Difference between revisions

From VistApedia
Jump to navigationJump to search
No edit summary
NeilArmstrong (talk | contribs)
Added glossary link to Prompt~
 
(6 intermediate revisions by 3 users not shown)
Line 10: Line 10:
  ;"
  ;"
  ;" This program will launch a shell for the TMG STEP TRAP debugger
  ;" This program will launch a shell for the TMG STEP TRAP debugger
  ;" It provides the user with a prompt, like this:
  ;" It provides the user with a [[prompt~|Prompt]], like this:
  ;"
  ;"
  ;"      (^ to quit) IDE>
  ;"      (^ to quit) IDE>
Line 28: Line 28:
   
   
  Start
  Start
        new ScrHeight set ScrHeight=10 ;"defined in ShowCode also
      set TMGScrWidth=70
        new ScrWidth set ScrWidth=70   ;"defined in ShowCode also
      set TMGScrHeight=10
      set tpWatchLine=""
 
      do SetGlobals^TMGTERM
     
      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~|Prompt]]
Done
      do ShutDown
      quit
   
   
        set ^TMP("TMGIDE",$J,"ScrWidth")=ScrWidth
;"-------------------------------------------------------------------
        set ^TMP("TMGIDE",$J,"ScrHeight")=ScrHeight
   
   
        do SetGlobals^TMGTERM
[[Prompt~|Prompt]]
        set ^TMP("TMGIDE",$J,"Normal Foreground Color")=TMGcYellow
      new Line
        set ^TMP("TMGIDE",$J,"Normal Background Color")=TMGcBlack
      do INITKB^XGF("*")  ;"set up keyboard input escape code processing
        set ^TMP("TMGIDE",$J,"Debug Foreground Color")=TMGcBlack
     
        set ^TMP("TMGIDE",$J,"Debug Background Color")=TMGcWhite
Ppt2     
      ;"write !,"(^ to quit) IDE>"
      ;"set Line=$$READ^XGF write !
     
      read !,"(^ to quit) IDE>",Line,!
   
   
        ;"write #  ;"formfeed
      if Line="^" set $ZSTEP="" quit
        ;"do CUP^TMGTERM(1,ScrHeight+1)
      set $ZSTEP="N TMGTrap S TMGTrap=$$STEPTRAP^TMGTPSTP($ZPOS) zstep:(TMGTrap=1) into zstep:(TMGTrap=2) over zcontinue"
        for i=1:1:80 write !
      ;set $ZSTEP="do STEPTRAP^TMGTPSTP($ZPOS) zstep into zcontinue"
        write !,"Welcome to the TMG debugging environment",!
        write "Enter any valid M command...",!
        set $ZTRAP="write !,""This is a ZTRAP line"",! break"
        set $ZSTATUS=""
   
   
        ;"Run modes: 0=fast mode  1=slow mode 2=Don't show code
      set TMGRunMode=1  ;"1=Step-by-step mode
        set ^TMP("TMGIDE",$J,"Run Mode")=0
      zstep into
        new BlankLine set BlankLine=" "
      xecute Line
        for i=1:1:ScrWidth-1 set BlankLine=BlankLine_" "
      set $ZSTEP=""  ;"turn off step capture
   
      goto Ppt2
        do Prompt
Done
        do ShutDown
        quit
   
   
;"-------------------------------------------------------------------
       
ShutDown
      do KillGlobals^TMGTERM
     
      kill TMGScrWidth
      kill TMGScrHeight
      kill tpWatchLine
      kill ^TMP("TMGIDE",$J,"MODULES")
      do VTATRIB^TMGTERM(0)
      do RESETKB^XGF  ;"turn off XGF escape key processing code.
      write "Leaving TMG debugging environment.  Goodbye.",!
      quit
     
  ;"-------------------------------------------------------------------
  ;"-------------------------------------------------------------------
   
   
  Prompt
  BKPT
        new Line
         read "Enter breakpoint (e.g. Label+8^MyFunct): ",Pos,!
        write !,BlankLine,!
         set Pos=Pos_":""n tmg s tmg=$$STEPTRAP^TMGTPSTP($ZPOS,1)"""
        do CUU^TMGTERM(1)
         ZBREAK @Pos
         read "(^ to quit) IDE>",Line
         write "ZBREAK ",Pos,!
          
         if Line="^" set $ZSTEP="" quit
        set $ZSTEP="do STEPTRAP^TMGTRSTP($ZPOS) zstep into zcontinue"
        zstep into
        xecute Line
        set $ZSTEP="" ;"turn off step capture
         goto Prompt
ShutDown
         ;"do ShowCode("",1)
        kill ^TMP("TMGIDE",$J)
         do KillGlobals^TMGTERM
         quit
         quit

Latest revision as of 02:24, 4 March 2012

;"------------------------------------------------------------
;"------------------------------------------------------------
;"
;" 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
      set tpWatchLine=""
 
      do SetGlobals^TMGTERM
      
      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
      do INITKB^XGF("*")  ;"set up keyboard input escape code processing
      
Ppt2       
      ;"write !,"(^ to quit) IDE>"
      ;"set Line=$$READ^XGF write !
      
      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 Ppt2

;"-------------------------------------------------------------------
       
ShutDown
      do KillGlobals^TMGTERM
      
      kill TMGScrWidth
      kill TMGScrHeight
      kill tpWatchLine
      kill ^TMP("TMGIDE",$J,"MODULES")
      do VTATRIB^TMGTERM(0)
      do RESETKB^XGF  ;"turn off XGF escape key processing code.
      write "Leaving TMG debugging environment.  Goodbye.",! 
      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