Difference between revisions of "TMGIDE.m"

From VistApedia
Jump to: navigation, search
 
(Added glossary link to Prompt~)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
;"------------------------------------------------------------
+
;"------------------------------------------------------------
;"------------------------------------------------------------
+
;"------------------------------------------------------------
;"
+
;"
;" GT.M Debug Tracer
+
;" GT.M Debug Tracer
;"
+
;"
;" K. Toppenberg
+
;" K. Toppenberg
;" 4-13-2005
+
;" 4-13-2005
;" License: GPL Applies
+
;" License: GPL Applies
;"
+
;"
;"
+
;"
;" 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>
;"
+
;"
;" Any valid M code may be entered here.  To use the tracing
+
;" Any valid M code may be entered here.  To use the tracing
;" ability, launch a function, like this:
+
;" ability, launch a function, like this:
;"
+
;"
;"      (^ to quit) IDE>do ^MyFunction
+
;"      (^ to quit) IDE>do ^MyFunction
;"
+
;"
;"
+
;"
;" Dependancies:
+
;" Dependancies:
;"    Uses TMGTRSTP,TMGTERM
+
;"    Uses TMGTRSTP,TMGTERM
;"
+
;"
;"------------------------------------------------------------
+
;"------------------------------------------------------------
;"------------------------------------------------------------
+
;"------------------------------------------------------------
 +
 
 
   
 
   
 
+
Start
Start
+
      set TMGScrWidth=70
        new ScrHeight set ScrHeight=10 ;"defined in ShowCode also
+
      set TMGScrHeight=10
        new ScrWidth set ScrWidth=70  ;"defined in ShowCode also
+
      set tpWatchLine=""
 
+
 
        set ^TMP("TMGIDE",$J,"ScrWidth")=ScrWidth
+
      do SetGlobals^TMGTERM
        set ^TMP("TMGIDE",$J,"ScrHeight")=ScrHeight
+
     
 
+
      for i=1:1:80 write !
        do SetGlobals^TMGTERM
+
      write !,"Welcome to the TMG debugging environment",!
        set ^TMP("TMGIDE",$J,"Normal Foreground Color")=TMGcYellow
+
      write "Enter any valid M command...",!
        set ^TMP("TMGIDE",$J,"Normal Background Color")=TMGcBlack
+
      set $ZTRAP="do ErrTrap^TMGTPSTP($ZPOS) break"
        set ^TMP("TMGIDE",$J,"Debug Foreground Color")=TMGcBlack
+
      set $ZSTATUS=""
        set ^TMP("TMGIDE",$J,"Debug Background Color")=TMGcWhite
+
 
 
+
      do [[Prompt~|Prompt]]
        ;"write #  ;"formfeed
+
Done
        ;"do CUP^TMGTERM(1,ScrHeight+1)
+
      do ShutDown
        for i=1:1:80 write !
+
      quit
        write !,"Welcome to the TMG debugging environment",!
+
        write "Enter any valid M command...",!
+
;"-------------------------------------------------------------------
        set $ZTRAP="write !,""This is a ZTRAP line"",! break"
+
        set $ZSTATUS=""
+
[[Prompt~|Prompt]]
 
+
      new Line
        ;"Run modes: 0=fast mode  1=slow mode 2=Don't show code
+
      do INITKB^XGF("*")  ;"set up keyboard input escape code processing
        set ^TMP("TMGIDE",$J,"Run Mode")=0
+
     
        new BlankLine set BlankLine=" "
+
Ppt2     
        for i=1:1:ScrWidth-1 set BlankLine=BlankLine_" "
+
      ;"write !,"(^ to quit) IDE>"
 
+
      ;"set Line=$$READ^XGF write !
        do Prompt
+
     
Done
+
      read !,"(^ to quit) IDE>",Line,!
        do ShutDown
+
        quit
+
      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"
 
+
Prompt
+
      set TMGRunMode=1  ;"1=Step-by-step mode
        new Line
+
      zstep into
        write !,BlankLine,!
+
      xecute Line
        do CUU^TMGTERM(1)
+
      set $ZSTEP=""  ;"turn off step capture
        read "(^ to quit) IDE>",Line
+
      goto Ppt2
 
+
        if Line="^" set $ZSTEP="" quit
+
;"-------------------------------------------------------------------
        set $ZSTEP="do STEPTRAP^TMGTRSTP($ZPOS) zstep into zcontinue"
+
       
        zstep into
+
ShutDown
        xecute Line
+
      do KillGlobals^TMGTERM
        set $ZSTEP=""  ;"turn off step capture
+
     
        goto Prompt
+
      kill TMGScrWidth
 
+
      kill TMGScrHeight
ShutDown
+
      kill tpWatchLine
        ;"do ShowCode("",1)
+
      kill ^TMP("TMGIDE",$J,"MODULES")
        kill ^TMP("TMGIDE",$J)
+
      do VTATRIB^TMGTERM(0)
        do KillGlobals^TMGTERM
+
      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
 
         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