Module: _dbgmenu      Library: Clipper 5.3


This module contains the following functions and procedures:



Note: Because this is raw decompiler output, the code is closer
to that seen in a .PPO file, rather than a .PRG file. In other
words, you must allow for the preprocessor conversions normally 
performed based on the contents of STD.CH and other .CH files
 
#include "common.ch"
#include "inkey.ch"

//-----------------------------------------------------------------
//  file-wide static variables
//
static Static1, Static2:= 0, Static3[18], Static4, Static5, ;
   Static6 := {"W+/BG", "N/BG", "R/BG", "N+/BG", "W+/B", "GR+/B", ;
   "W/B", "N/W", "R/W", "N/BG", "R/BG"}, Static7 := {"+W/N", "W/N", ;
   "+W/N", "W/N", "N/W", "N/W", "N/W", "N/W", "+W/W", "W/N", ;
   "+W/N"}, Static8 := 1

//---------------------------------------------------[top]-
//  __DBGCLR( Arg1 )
//
function __DBGCLR( Arg1 )

   return iif( !Static3[ 16 ], Static6[ Arg1 ], Static7[ Arg1 ] )

//---------------------------------------------------[top]-
//  GETOLDCOMM
//
static function GETOLDCOMM

   local Local1 := "DELETE", Local2:= "ALL", Local3:= "CALLSTACK", ;
      Local4 := "LIST", Local5:= "NUM", Local6:= "BP", Local7:= "WP", ;
      Local8 := "TP", Local9:= "ON", Local10:= "OFF"
   return {{{".", 1, 2}}, {{"?", 1, 50}}, {{"??", 2, 51}}, ;
      {{"ANIMATE", 4, 20}}, {{Local6, 2, 255}, {"AT", 2, 55}}, ;
      {{Local6, 2, 55}}, {{Local3, 4, 255}, {Local9, 2, 65}}, ;
      {{Local3, 4, 255}, {Local10, 3, 66}}, {{Local3, 4, 18}}, ;
      {{"COLOR", 4, 38}}, {{Local1, 4, 255}, {Local2, 3, 255}, ;
      {Local6, 2, 62}}, {{Local1, 4, 255}, {Local2, 3, 255}, ;
      {Local7, 2, 63}}, {{Local1, 4, 255}, {Local2, 3, 255}, ;
      {Local8, 2, 64}}, {{Local1, 4, 255}, {Local2, 3, 61}}, ;
      {{Local1, 4, 255}, {Local6, 2, 57}}, {{Local1, 4, 255}, ;
      {Local7, 2, 25}}, {{Local1, 4, 255}, {Local8, 2, 25}}, ;
      {{"DOS", 3, 3}}, {{"FIND", 4, 5}}, {{"GO", 1, 46}}, {{"GOTO", ;
      4, 8}}, {{"HELP", 4, 41}}, {{"INPUT", 4, 59}}, {{Local4, 4, ;
      255}, {Local6, 2, 53}}, {{Local4, 4, 255}, {Local7, 2, 54}}, ;
      {{Local4, 4, 255}, {Local8, 2, 54}}, {{"NEXT", 4, 6}}, ;
      {{Local5, 3, 255}, {Local9, 2, 67}}, {{Local5, 3, 255}, ;
      {Local10, 3, 68}}, {{Local5, 3, 14}}, {{"OUTPUT", 4, 11}}, ;
      {{"PREV", 4, 7}}, {{"QUIT", 1, 4}}, {{"RESUME", 4, 2}}, ;
      {{"SPEED", 4, 21}}, {{"STEP", 4, 47}}, {{Local8, 2, 24}}, ;
      {{"VIEW", 4, 1}}, {{Local7, 2, 23}}}

//---------------------------------------------------[top]-
//  HIDEMENU( Arg1 )
//
static procedure HIDEMENU( Arg1 )

   RestScreen(Arg1[ 5 ], Arg1[ 6 ], Arg1[ 7 ] + 1, Arg1[ 8 ] + 2, ;
      Static5)
   Static5 := Nil
   dispoutat(0, Arg1[ 2 ] - 1, " " + SubStr(Arg1[ 1 ], 1, 1), iif( ;
      !Static3[ 16 ], Static6[ 9 ], Static7[ 9 ] ))
   dispout(SubStr(Arg1[ 1 ], 2) + " ", iif( !Static3[ 16 ], ;
      Static6[ 8 ], Static7[ 8 ] ))
   return

//---------------------------------------------------[top]-
//  INITMENUS
//
static procedure INITMENUS

   Static4 := {}
   mnuadd(Static4, "File")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Open..." ), Nil, ;
      {"Open...", 1, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Resume" ), Nil, ;
      {"Resume", 2, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "DOS Shell" ), ;
      Nil, {"DOS Shell", 3, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( Nil ), Nil, {Nil, ;
      Nil, Nil, Nil} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "eXit     Alt-X" ;
      ), Nil, {"eXit     Alt-X", 4, 0, 2} ))
   mnuadd(Static4, "Locate")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Find..." ), Nil, ;
      {"Find...", 5, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Next" ), Nil, ;
      {"Next", 6, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Previous" ), Nil, ;
      {"Previous", 7, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Goto Line..." ), ;
      Nil, {"Goto Line...", 8, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( Nil ), Nil, {Nil, ;
      Nil, Nil, Nil} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Case Sensitive" ;
      ), Nil, {"Case Sensitive", 9, 1, 1} ))
   mnuadd(Static4, "View")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Sets" ), Nil, ;
      {"Sets", 17, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Workareas   F6" ;
      ), Nil, {"Workareas   F6", 16, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "App Screen  F4" ;
      ), Nil, {"App Screen  F4", 11, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( Nil ), Nil, {Nil, ;
      Nil, Nil, Nil} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Callstack" ), ;
      Nil, {"Callstack", 18, 6, 1} ))
   mnuadd(Static4, "Run")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Animate" ), Nil, ;
      {"Animate", 20, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( ;
      "Step              F8" ), Nil, {"Step              F8", 47, 0, ;
      1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( ;
      "Trace            F10" ), Nil, {"Trace            F10", 48, 0, ;
      1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( ;
      "Go                F5" ), Nil, {"Go                F5", 46, 0, ;
      1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( ;
      "to Cursor         F7" ), Nil, {"to Cursor         F7", 49, 0, ;
      4} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( ;
      "Next routine Ctrl-F5" ), Nil, {"Next routine Ctrl-F5", 71, 0, ;
      1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( Nil ), Nil, {Nil, ;
      Nil, Nil, Nil} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "sPeed..." ), Nil, ;
      {"sPeed...", 21, 0, 2} ))
   mnuadd(Static4, "Point")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Watchpoint..." ), ;
      Nil, {"Watchpoint...", 23, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Tracepoint..." ), ;
      Nil, {"Tracepoint...", 24, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Breakpoint   F9" ;
      ), Nil, {"Breakpoint   F9", 58, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Delete..." ), ;
      Nil, {"Delete...", 25, 0, 1} ))
   mnuadd(Static4, "Monitor")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Public" ), Nil, ;
      {"Public", 26, 10, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "priVate" ), Nil, ;
      {"priVate", 27, 11, 4} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Static" ), Nil, ;
      {"Static", 28, 12, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Local" ), Nil, ;
      {"Local", 29, 13, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( Nil ), Nil, {Nil, ;
      Nil, Nil, Nil} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "All" ), Nil, ;
      {"All", 72, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "sOrt" ), Nil, ;
      {"sOrt", 30, 14, 2} ))
   mnuadd(Static4, "Options")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( ;
      "Preprocessed Code" ), Nil, {"Preprocessed Code", 10, 2, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Line Numbers" ), ;
      Nil, {"Line Numbers", 14, 5, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Exchange Screens" ;
      ), Nil, {"Exchange Screens", 12, 3, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "swap on Input" ), ;
      Nil, {"swap on Input", 13, 4, 9} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "codeBlock Trace" ;
      ), Nil, {"codeBlock Trace", 22, 9, 5} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Menu Bar" ), Nil, ;
      {"Menu Bar", 36, 15, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "mono Display" ), ;
      Nil, {"mono Display", 37, 16, 6} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Colors..." ), ;
      Nil, {"Colors...", 38, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Tab Width..." ), ;
      Nil, {"Tab Width...", 15, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( ;
      "path for Files..." ), Nil, {"path for Files...", 70, 0, 10} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( Nil ), Nil, {Nil, ;
      Nil, Nil, Nil} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Save Settings..." ;
      ), Nil, {"Save Settings...", 60, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( ;
      "Restore Settings..." ), Nil, {"Restore Settings...", 59, 0, ;
      1} ))
   mnuadd(Static4, "Window")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Next      Tab" ), ;
      Nil, {"Next      Tab", 39, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Prev   Sh-Tab" ), ;
      Nil, {"Prev   Sh-Tab", 40, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Move" ), Nil, ;
      {"Move", 31, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Size" ), Nil, ;
      {"Size", 32, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Zoom       F2" ), ;
      Nil, {"Zoom       F2", 33, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Iconize" ), Nil, ;
      {"Iconize", 34, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( Nil ), Nil, {Nil, ;
      Nil, Nil, Nil} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Tile" ), Nil, ;
      {"Tile", 35, 0, 1} ))
   mnuadd(Static4, "Help")
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "About Help" ), ;
      Nil, {"About Help", 41, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( Nil ), Nil, {Nil, ;
      Nil, Nil, Nil} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Keys" ), Nil, ;
      {"Keys", 42, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Windows" ), Nil, ;
      {"Windows", 43, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Menus" ), Nil, ;
      {"Menus", 44, 0, 1} ))
   AAdd(Static4[ Len(Static4) ][ 3 ], iif( ISNIL( "Commands" ), Nil, ;
      {"Commands", 45, 0, 1} ))
   mnuend(Static4)
   return

//---------------------------------------------------[top]-
//  KEYSELECT( Arg1, Arg2 )
//
static function KEYSELECT( Arg1, Arg2 )

   local Local1 := Upper(Chr(Arg2)), Local2, Local3
   for Local2 := 1 to Len(Arg1[ 3 ])
      if ( !Empty(Arg1[ 3 ][ Local2 ]) .AND. !Empty(( Local3 := ;
            Arg1[ 3 ][ Local2 ][ 4 ], Local3 )) .AND. Local1 == ;
            SubStr(Arg1[ 3 ][ Local2 ][ 1 ], Local3, 1) )
         Arg1[ 4 ] := Local2
         return .T.
      endif
   next
   return .F.

//---------------------------------------------------[top]-
//  MNUADD( Arg1, Arg2 )
//
static procedure MNUADD( Arg1, Arg2 )

   AAdd(Arg1, {Arg2, Static8, {}, 1, Nil, Nil, Nil, Nil})
   Static8 := Static8 + ( Len(Arg2) + 2 )
   return

//---------------------------------------------------[top]-
//  MNUEND( Arg1 )
//
static procedure MNUEND( Arg1 )

   local Local1, Local2, Local3
   for Local2 := 1 to Len(Arg1)
      Local1 := 0
      for Local3 := 1 to Len(Arg1[ Local2 ][ 3 ])
         if ( !Empty(Arg1[ Local2 ][ 3 ][ Local3 ]) )
            Local1 := iif( Local1 > ;
               Len(Arg1[ Local2 ][ 3 ][ Local3 ][ 1 ]), Local1, ;
               Len(Arg1[ Local2 ][ 3 ][ Local3 ][ 1 ]) )
         endif
      next
      Local1 := iif( Local1 > Len(Arg1[ Local2 ][ 1 ]), Local1, ;
         Len(Arg1[ Local2 ][ 1 ]) ) + 5
      Arg1[ Local2 ][ 5 ] := 1
      Arg1[ Local2 ][ 6 ] := iif( Arg1[ Local2 ][ 2 ] - 1 < MaxCol() ;
         - Local1 + 3, Arg1[ Local2 ][ 2 ] - 1, MaxCol() - Local1 + ;
         3 )
      Arg1[ Local2 ][ 7 ] := Arg1[ Local2 ][ 5 ] + ( ;
         Len(Arg1[ Local2 ][ 3 ]) + 2 ) - 1
      Arg1[ Local2 ][ 8 ] := Arg1[ Local2 ][ 6 ] + Local1 - 1
   next
   return

//---------------------------------------------------[top]-
//  MNUTOPOS( Arg1, Arg2 )
//
static procedure MNUTOPOS( Arg1, Arg2 )

   dispbegin()
   paintitem(Arg1, Arg1[ 4 ], iif( !Static3[ 16 ], Static6[ 8 ], ;
      Static7[ 8 ] ), iif( !Static3[ 16 ], Static6[ 9 ], ;
      Static7[ 9 ] ))
   paintitem(Arg1, Arg1[ 4 ] := Arg2, iif( !Static3[ 16 ], ;
      Static6[ 10 ], Static7[ 10 ] ), iif( !Static3[ 16 ], ;
      Static6[ 11 ], Static7[ 11 ] ))
   dispend()
   return

//---------------------------------------------------[top]-
//  NEXTWORD( Arg1 )
//
static function NEXTWORD( Arg1 )

   local Local1, Local2
   do while ( Len(Arg1) > 0 .AND. SubStr(Arg1, 1, 1) == " " )
      Arg1 := SubStr(Arg1, 2)
   enddo
   if ( Len(Arg1) > 0 )
      if ( !isalpha(Arg1) )
         Local2 := 2
         do while ( Local2 <= Len(Arg1) .AND. SubStr(Arg1, Local2, ;
               1) != " " .AND. !isalpha(SubStr(Arg1, Local2, 1)) )
            Local2++
         enddo
         Local1 := SubStr(Arg1, 1, Local2 - 1)
         Arg1 := SubStr(Arg1, Len(Local1) + 1)
      elseif ( " " $ Arg1 )
         Local1 := SubStr(Arg1, 1, At(" ", Arg1) - 1)
         Arg1 := SubStr(Arg1, Len(Local1) + 1)
      else
         Local1 := Arg1
         Arg1 := ""
      endif
   else
      Local1 := ""
   endif
   return Local1

//---------------------------------------------------[top]-
//  OLDCMD( Arg1 )
//
static function OLDCMD( Arg1 )

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7, ;
      Local8, Local9 := getoldcomm()
   Local8 := Arg1
   Local5 := 255
   for Local3 := 1 to Len(Local9)
      Arg1 := Local8
      Local2 := Local9[ Local3 ]
      Local7 := .T.
      for Local4 := 1 to Len(Local2)
         Local6 := nextword(@Arg1)
         Local1 := Local9[ Local3 ][ Local4 ][ 1 ]
         if ( Len(Local6) < Local9[ Local3 ][ Local4 ][ 2 ] .OR. ;
               Len(Local6) > Len(Local1) .OR. Upper(Local6) != ;
               SubStr(Local1, 1, Len(Local6)) )
            Local7 := .F.
            exit
         endif
      next
      if ( Local7 )
         Local5 := Local9[ Local3 ][ Local4 - 1 ][ 3 ]
         exit
      endif
   next
   if ( Local5 == 255 )
      Arg1 := ""
   endif
   Local9 := Nil
   return i2bin(Local5) + Arg1

//---------------------------------------------------[top]-
//  PAINTITEM( Arg1, Arg2, Arg3, Arg4 )
//
static procedure PAINTITEM( Arg1, Arg2, Arg3, Arg4 )

   dispoutat(Arg1[ 5 ] + Arg2, Arg1[ 6 ] + 1, pad("  " + ;
      Arg1[ 3 ][ Arg2 ][ 1 ], Arg1[ 8 ] - Arg1[ 6 ] - 1), Arg3)
   if ( iif( !( Arg1[ 3 ][ Arg2 ][ 3 ] == 0 ), ;
         Static3[ Arg1[ 3 ][ Arg2 ][ 3 ] ], .F. ) )
      dispoutat(Arg1[ 5 ] + Arg2, Arg1[ 6 ] + 1, "", Arg3)
   endif
   if ( !( Arg1[ 3 ][ Arg2 ][ 4 ] == 0 ) )
      dispoutat(Arg1[ 5 ] + Arg2, Arg1[ 6 ] + 3 + ;
         Arg1[ 3 ][ Arg2 ][ 4 ] - 1, SubStr(Arg1[ 3 ][ Arg2 ][ 1 ], ;
         Arg1[ 3 ][ Arg2 ][ 4 ], 1), Arg4)
   endif
   return

//---------------------------------------------------[top]-
//  PAINTMENU( Arg1 )
//
static procedure PAINTMENU( Arg1 )

   local Local1
   @ Arg1[ 5 ], Arg1[ 6 ], Arg1[ 7 ], Arg1[ 8 ] box Nil color iif( ;
      !Static3[ 16 ], Static6[ 8 ], Static7[ 8 ] )
   dbgshadow(Arg1[ 5 ], Arg1[ 6 ], Arg1[ 7 ], Arg1[ 8 ])
   for Local1 := 1 to Len(Arg1[ 3 ])
      if ( !Empty(Arg1[ 3 ][ Local1 ]) )
         if ( Local1 == Arg1[ 4 ] )
            paintitem(Arg1, Local1, iif( !Static3[ 16 ], ;
               Static6[ 10 ], Static7[ 10 ] ), iif( !Static3[ 16 ], ;
               Static6[ 11 ], Static7[ 11 ] ))
         else
            paintitem(Arg1, Local1, iif( !Static3[ 16 ], ;
               Static6[ 8 ], Static7[ 8 ] ), iif( !Static3[ 16 ], ;
               Static6[ 9 ], Static7[ 9 ] ))
         endif
      else
         dispoutat(Arg1[ 5 ] + Local1, Arg1[ 6 ], "", iif( ;
            !Static3[ 16 ], Static6[ 8 ], Static7[ 8 ] ))
         dispout(Replicate("", Arg1[ 8 ] - 1 - ( Arg1[ 6 ] + 1 ) + ;
            1), iif( !Static3[ 16 ], Static6[ 8 ], Static7[ 8 ] ))
         dispout("", iif( !Static3[ 16 ], Static6[ 8 ], ;
            Static7[ 8 ] ))
      endif
   next
   return

//---------------------------------------------------[top]-
//  SHOWMENU( Arg1 )
//
static procedure SHOWMENU( Arg1 )

   Static5 := SaveScreen(Arg1[ 5 ], Arg1[ 6 ], Arg1[ 7 ] + 1, ;
      Arg1[ 8 ] + 2)
   dispoutat(0, Arg1[ 2 ] - 1, " " + SubStr(Arg1[ 1 ], 1, 1), iif( ;
      !Static3[ 16 ], Static6[ 11 ], Static7[ 11 ] ))
   dispout(SubStr(Arg1[ 1 ], 2) + " ", iif( !Static3[ 16 ], ;
      Static6[ 10 ], Static7[ 10 ] ))
   if ( mleftdown() )
      Arg1[ 4 ] := subhittest(Arg1, mrow(), mcol())
   else
      Arg1[ 4 ] := 1
   endif
   paintmenu(Arg1)
   return

//---------------------------------------------------[top]-
//  SUBHITTEST( Arg1, Arg2, Arg3 )
//
static function SUBHITTEST( Arg1, Arg2, Arg3 )

   local Local1 := 0
   do case
   case Arg2 <= Arg1[ 5 ]
   case Arg2 >= Arg1[ 7 ]
   case Arg3 <= Arg1[ 6 ]
   case Arg3 >= Arg1[ 8 ]
   case !Empty(Arg1[ 3 ][ Arg2 - Arg1[ 5 ] ])
      Local1 := Arg2 - Arg1[ 5 ]
   endcase
   return Local1

//---------------------------------------------------[top]-
//  TOPHITTEST( Arg1, Arg2, Arg3 )
//
static function TOPHITTEST( Arg1, Arg2, Arg3 )

   local Local1, Local2, Local3
   if ( Arg2 == 0 )
      Local2 := Len(Arg1)
      for Local1 := 1 to Local2
         if ( Arg3 < Arg1[ Local1 ][ 2 ] )
         elseif ( Arg3 < Arg1[ Local1 ][ 2 ] + ;
               Len(Arg1[ Local1 ][ 1 ]) )
            return Local1
         endif
      next
   endif
   return 0

//---------------------------------------------------[top]-
//  __DBGCMD( Arg1 )
//
function __DBGCMD( Arg1 )

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7
   if ( ISNIL( Static4 ) )
      initmenus()
   endif
   Local7 := Arg1
   Local1 := nextword(@Local7)
   if ( Local7 == "" )
      return oldcmd(Arg1)
   endif
   for Local4 := 1 to Len(Static4)
      if ( Upper(Local1) == Upper(SubStr(Static4[ Local4 ][ 1 ], 1, ;
            Len(Local1))) )
         Local5 := Static4[ Local4 ]
         exit
      endif
   next
   if ( ISNIL( Local5 ) )
      return oldcmd(Arg1)
   endif
   Local1 := nextword(@Local7)
   Local6 := Nil
   for Local4 := 1 to Len(Local5[ 3 ])
      if ( !Empty(Local5[ 3 ][ Local4 ]) .AND. Upper(Local1) == ;
            Upper(SubStr(Local5[ 3 ][ Local4 ][ 1 ], 1, ;
            Len(Local1))) )
         Local6 := Local5[ 3 ][ Local4 ]
         Local3 := At(" ", LTrim(Local5[ 3 ][ Local4 ][ 1 ]))
         if ( !Empty(Local3) .AND. !Empty(Local7) .AND. Upper(( ;
               Local1 := alltrim(nextword(Local7)), Local2:= ;
               alltrim(SubStr(Local5[ 3 ][ Local4 ][ 1 ], Local3 + ;
               1, Len(Local1))), Local2 )) == Upper(Local1) )
            nextword(@Local7)
         endif
         exit
      endif
   next
   if ( ISNIL( Local6 ) )
      return oldcmd(Arg1)
   endif
   return i2bin(Local6[ 2 ]) + Local7

//---------------------------------------------------[top]-
//  __DBGCMDS( Arg1 )
//
function __DBGCMDS( Arg1 )

   local Local1 := "", Local2, Local3, Local4, Local5, Local6, ;
      Local7 := getoldcomm()
   Arg1 := Val(Arg1)
   if ( ISNIL( Static4 ) )
      initmenus()
   endif
   for Local2 := 1 to Len(Static4)
      Local4 := Static4[ Local2 ]
      for Local3 := 1 to Len(Local4[ 3 ])
         if ( !Empty(Local4[ 3 ][ Local3 ]) .AND. Arg1 == ;
               Local4[ 3 ][ Local3 ][ 2 ] )
            Local6 := nextword(Local4[ 3 ][ Local3 ][ 1 ])
            if ( "." $ Local6 )
               Local6 := SubStr(Local6, 1, At(".", Local6) - 1)
            endif
            Local1 := Local4[ 1 ] + " " + Local6 + " "
            exit
         endif
      next
   next
   if ( Local1 == "" )
      for Local2 := Len(Local7) to 1 step -1
         Local5 := Local7[ Local2 ]
         if ( Local5[ Len(Local5) ][ 3 ] == Arg1 )
            for Local3 := 1 to Len(Local5)
               Local1 := Local1 + ( Local5[ Local3 ][ 1 ] + " " )
            next
            exit
         endif
      next
   endif
   Local7 := Nil
   return Local1

//---------------------------------------------------[top]-
//  __DBGCPICK( Arg1, Arg2 )
//
procedure __DBGCPICK( Arg1, Arg2 )

   __dbgsaves()
   if ( !Static3[ 16 ] )
      if ( ISARRAY( Arg2 ) .AND. Len(Arg2) == 11 )
         Static6 := Arg2
      else
         Static6 := inspectcol(aclone(Static6))
      endif
   else
      alert(__dbgtext(16), "N/W, N/BG")
   endif
   __dbgrests()
   return

//---------------------------------------------------[top]-
//  __DBGCTEXT( Arg1 )
//
function __DBGCTEXT( Arg1 )

   return {"Command", "Watch", "Monitor", "Calls", ;
      "(File unavailable)", "Undefined", ;
      "Not evaluated at this activation", "Command error", "wp", ;
      "tp"}[ Val(Arg1) ]

//---------------------------------------------------[top]-
//  __DBGDOS
//
procedure __DBGDOS

   local Local1, Local2
   msetcursor(.F.)
   __dbgsaves()
   save screen to Local1
   Local2 := SetColor("W/N")
   setcursor(1)
   clear screen
   ? __dbgtext(26)
   run Command.com
   restore screen from Local1
   setcursor(0)
   set color to (Local2)
   __dbgrests()
   msetcursor(.T.)
   return

//---------------------------------------------------[top]-
//  __DBGMBAR
//
function __DBGMBAR

   local Local1 := Space(1)
   if ( ISNIL( Static4 ) )
      initmenus()
   endif
   aeval(Static4, { |_1| Local1 := Local1 + ( _1[ 1 ] + Space(2) ) })
   return Local1

//---------------------------------------------------[top]-
//  __DBGMENU( Arg1 )
//
function __DBGMENU( Arg1 )

   local Local1, Local2 := 0, Local3:= mleftdown(), Local4
   Arg1 := Val(Arg1)
   __dbgsaves()
   msetcursor(.T.)
   if ( ISNIL( Static4 ) )
      initmenus()
   endif
   if ( Len(Static4) < Arg1 )
      return i2bin(255)
   endif
   Local1 := Static4[ Arg1 ]
   if ( Local3 )
      Local1[ 4 ] := subhittest(Local1, mrow(), mcol())
   endif
   dispbegin()
   showmenu(Local1)
   dispend()
   do while ( !( ( Local2 := InKey(0) ) == 27 ) )
      do case
      case Local2 == 13
         if ( Len(Local1[ 3 ]) > 0 )
            exit
         endif
      case Local2 == 1002 .OR. Local3 .AND. Local2 == 1001
         Local3 := .T.
         dispbegin()
         if ( Local1[ 4 ] != 0 )
            paintitem(Local1, Local1[ 4 ], iif( !Static3[ 16 ], ;
               Static6[ 8 ], Static7[ 8 ] ), iif( !Static3[ 16 ], ;
               Static6[ 9 ], Static7[ 9 ] ))
         endif
         if ( ( Local1[ 4 ] := subhittest(Local1, mrow(), mcol()) ) ;
               != 0 )
            paintitem(Local1, Local1[ 4 ], iif( !Static3[ 16 ], ;
               Static6[ 10 ], Static7[ 10 ] ), iif( !Static3[ 16 ], ;
               Static6[ 11 ], Static7[ 11 ] ))
         elseif ( ( Local4 := tophittest(Static4, mrow(), mcol()) ) ;
               != 0 )
            hidemenu(Local1)
            Arg1 := Local4
            Local1 := Static4[ Arg1 ]
            showmenu(Local1)
         endif
         dispend()
      case Local2 == 1003
         if ( mrow() == 0 )
            Local1[ 4 ] := 1
            paintitem(Local1, Local1[ 4 ], iif( !Static3[ 16 ], ;
               Static6[ 10 ], Static7[ 10 ] ), iif( !Static3[ 16 ], ;
               Static6[ 11 ], Static7[ 11 ] ))
            Local3 := .F.
         elseif ( Local1[ 4 ] == 0 )
            Local2 := 27
            exit
         else
            Local2 := 13
            exit
         endif
      case Local2 == 5
         dispbegin()
         paintitem(Local1, Local1[ 4 ], iif( !Static3[ 16 ], ;
            Static6[ 8 ], Static7[ 8 ] ), iif( !Static3[ 16 ], ;
            Static6[ 9 ], Static7[ 9 ] ))
         do while ( .T. )
            if ( --Local1[ 4 ] < 1 )
               Local1[ 4 ] := Len(Local1[ 3 ])
            endif
            if ( !Empty(Local1[ 3 ][ Local1[ 4 ] ]) )
               exit
            endif
         enddo
         paintitem(Local1, Local1[ 4 ], iif( !Static3[ 16 ], ;
            Static6[ 10 ], Static7[ 10 ] ), iif( !Static3[ 16 ], ;
            Static6[ 11 ], Static7[ 11 ] ))
         dispend()
      case Local2 == 24
         dispbegin()
         paintitem(Local1, Local1[ 4 ], iif( !Static3[ 16 ], ;
            Static6[ 8 ], Static7[ 8 ] ), iif( !Static3[ 16 ], ;
            Static6[ 9 ], Static7[ 9 ] ))
         do while ( .T. )
            if ( ++Local1[ 4 ] > Len(Local1[ 3 ]) )
               Local1[ 4 ] := 1
            endif
            if ( !Empty(Local1[ 3 ][ Local1[ 4 ] ]) )
               exit
            endif
         enddo
         paintitem(Local1, Local1[ 4 ], iif( !Static3[ 16 ], ;
            Static6[ 10 ], Static7[ 10 ] ), iif( !Static3[ 16 ], ;
            Static6[ 11 ], Static7[ 11 ] ))
         dispend()
      case Local2 == 18
         mnutopos(Local1, 1)
      case Local2 == 31
         mnutopos(Local1, 1)
      case Local2 == 1
         mnutopos(Local1, 1)
      case Local2 == 3
         mnutopos(Local1, Len(Local1[ 3 ]))
      case Local2 == 30
         mnutopos(Local1, Len(Local1[ 3 ]))
      case Local2 == 6
         mnutopos(Local1, Len(Local1[ 3 ]))
      case Local2 == 19
         if ( --Arg1 < 1 )
            Arg1 := Len(Static4)
         endif
         dispbegin()
         hidemenu(Local1)
         showmenu(Local1 := Static4[ Arg1 ])
         dispend()
      case Local2 == 4
         if ( ++Arg1 > Len(Static4) )
            Arg1 := 1
         endif
         dispbegin()
         hidemenu(Local1)
         showmenu(Local1 := Static4[ Arg1 ])
         dispend()
      case keyselect(Local1, Local2)
         paintmenu(Local1)
         exit
      endcase
   enddo
   dispbegin()
   hidemenu(Local1)
   dispend()
   __dbgrests()
   return i2bin(iif( Local2 == 27, 255, Local1[ 3 ][ Local1[ 4 ] ;
      ][ 2 ] ))

//---------------------------------------------------[top]-
//  __DBGMKEY( Arg1 )
//
function __DBGMKEY( Arg1 )

   return Str({289, 294, 303, 275, 281, 306, 280, 273, ;
      291}[ Val(Arg1) ])

//---------------------------------------------------[top]-
//  __DBGRESTS
//
procedure __DBGRESTS

   Static2--
   if ( Static2 == 0 )
      SetPos(Asc(SubStr(Static1, 1, 1)), Asc(SubStr(Static1, 2, 1)))
      setcursor(Asc(SubStr(Static1, 3, 1)))
      Static1 := Nil
   endif
   return

//---------------------------------------------------[top]-
//  __DBGSAVES
//
procedure __DBGSAVES

   if ( Static2 == 0 )
      Static1 := Chr(Row()) + Chr(Col()) + Chr(setcursor())
   endif
   Static2++
   return

//---------------------------------------------------[top]-
//  __DBGSBAR
//
function __DBGSBAR

   return ;
      "F1-Help F2-Zoom F3-Repeat F4-User F5-Go F6-WA F7-Here F8-Step F9-BkPt F10-Trace"

//---------------------------------------------------[top]-
//  __DBGSCLR( Arg1 )
//
function __DBGSCLR( Arg1 )

   return iif( !Static3[ 16 ], Static6[ Val(Arg1) ], ;
      Static7[ Val(Arg1) ] )

//---------------------------------------------------[top]-
//  __DBGSET( Arg1, Arg2 )
//
procedure __DBGSET( Arg1, Arg2 )

   Static3[ Val(Arg1) ] := Arg2
   return

//---------------------------------------------------[top]-
//  __DBGSTATE
//
function __DBGSTATE

   return Static2

//---------------------------------------------------[top]-
//  __DBGTEXT( Arg1 )
//
function __DBGTEXT( Arg1 )

   return {"Window is Iconized", "Window is Zoomed", ;
      "Not available in split-screen mode", ;
      "Only available under CLD.EXE", "File unavailable", ;
      'Can"t create file", "Maximum breakpoints reached", ;
      "Maximum watchpoints reached", "Program terminated normally", ;
      "Array is empty", "Value cannot be edited", ;
      "Expression error", "Must be numeric", "Must be string", ;
      "Black on black", "Monochrome display", "No workareas in use", ;
      "Enter Watchpoint", "Enter Tracepoint", "File name", ;
      "Step delay (in tenths of a second)", "Tab width", ;
      "Item number to delete", "Search string", "Line number", ;
      "Type "exit" to return to the Debugger", ;
      "Search path for source files:", "System Settings ", ;
      "Debugger Colors ", "Border", "Text", "Text High", "Text PPO", ;
      "Text Selected", "Text High Sel.", "Text PPO Sel.", "Menu", ;
      "Menu High", "Menu Selected", "Menu High Sel."}[ Arg1 ]

//---------------------------------------------------[top]-
//  __WINDBGCM( Arg1 )
//
function __WINDBGCM( Arg1 )

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7
   if ( ISNIL( Static4 ) )
      initmenus()
   endif
   Local7 := Arg1
   Local1 := nextword(@Local7)
   if ( Local7 == "" )
      return oldcmd(Arg1)
   endif
   for Local4 := 1 to Len(Static4)
      if ( Upper(Local1) == Upper(SubStr(Static4[ Local4 ][ 1 ], 1, ;
            Len(Local1))) )
         Local5 := Static4[ Local4 ]
         exit
      endif
   next
   if ( ISNIL( Local5 ) )
      return oldcmd(Arg1)
   endif
   Local1 := nextword(@Local7)
   Local6 := Nil
   for Local4 := 1 to Len(Local5[ 3 ])
      if ( !Empty(Local5[ 3 ][ Local4 ]) .AND. Upper(Local1) == ;
            Upper(SubStr(Local5[ 3 ][ Local4 ][ 1 ], 1, ;
            Len(Local1))) )
         Local6 := Local5[ 3 ][ Local4 ]
         Local3 := At(" ", LTrim(Local5[ 3 ][ Local4 ][ 1 ]))
         if ( !Empty(Local3) .AND. !Empty(Local7) .AND. Upper(( ;
               Local1 := alltrim(nextword(Local7)), Local2:= ;
               alltrim(SubStr(Local5[ 3 ][ Local4 ][ 1 ], Local3 + ;
               1, Len(Local1))), Local2 )) == Upper(Local1) )
            nextword(@Local7)
         endif
         exit
      endif
   next
   if ( ISNIL( Local6 ) )
      return oldcmd(Arg1)
   endif
   return i2bin(Local6[ 2 ]) + Local7

//---EOF


Use your Browser's BACK button to return to Function Listings