TMGIDE.m

From VistApedia
Revision as of 22:12, 14 April 2005 by Kdtop3 (talk | contribs)
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
       new ScrHeight set ScrHeight=10 ;"defined in ShowCode also
       new ScrWidth set ScrWidth=70   ;"defined in ShowCode also

       set ^TMP("TMGIDE",$J,"ScrWidth")=ScrWidth
       set ^TMP("TMGIDE",$J,"ScrHeight")=ScrHeight

       do SetGlobals^TMGTERM
       set ^TMP("TMGIDE",$J,"Normal Foreground Color")=TMGcYellow
       set ^TMP("TMGIDE",$J,"Normal Background Color")=TMGcBlack
       set ^TMP("TMGIDE",$J,"Debug Foreground Color")=TMGcBlack
       set ^TMP("TMGIDE",$J,"Debug Background Color")=TMGcWhite

       ;"write #  ;"formfeed
       ;"do CUP^TMGTERM(1,ScrHeight+1)
       for i=1:1:80 write !
       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 ^TMP("TMGIDE",$J,"Run Mode")=0
       new BlankLine set BlankLine=" "
       for i=1:1:ScrWidth-1 set BlankLine=BlankLine_" "

       do Prompt
Done
       do ShutDown
       quit

;"-------------------------------------------------------------------

Prompt
       new Line
       write !,BlankLine,!
       do CUU^TMGTERM(1)
       read "(^ to quit) IDE>",Line

       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