home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rdebug21.zip / RDDEMO.KEX < prev    next >
Text File  |  1993-03-25  |  8KB  |  247 lines

  1. /*H* RDDEMO.KEX 01-30-93 10:45*/
  2.  arg dborigin parms
  3.  arg panel misc
  4.  Signal On Error;   Signal On Failure;  Signal On Halt
  5.  Signal On Novalue; Signal On Notready; Signal ON Syntax
  6.  me='RDDEMO'
  7.  dbme=me
  8.  dbtrc=0
  9.  dbc='COMMAND'
  10.  parse value dbc 'SET!'dbc 'X!'dbc 'EXT!'dbc 'SOS' With dbcs'!'dbxx'!'dbce'!'dbso
  11.  dbce '/OPSYS'
  12.  dbme='rddemo'
  13.  dbsys=opsys.1
  14.  if dbsys='OS/2' then dbsys='OS2'     /*O*/
  15.  Parse Value 0 With dbtrc dbtrap dbtrapp dbmsg dbstr
  16.  if dborigin=''  then panel='FINIS'
  17.  if dborigin='?' then /* Exit */ Return tell(me)
  18.  list='WELCOME PROFILE SOURCE LOG'
  19.  answer=''
  20.  else do
  21.    box=db3box(panel)
  22.    if left(box,4)='BOX.' then do
  23.      'EMSG' rdbmsg(111 panel)
  24.      return 0; end
  25.    call dialog
  26.  end
  27.  /* Exit */ Return answer
  28.  
  29.  DB3BOX:
  30.  arg box
  31.  lf = d2c(10)
  32.  signal value(box)
  33.  DIALOG:
  34.  parse var box code1 action1 '!' code2 action2 '!' object statement
  35.  if object = "DIALOG" then do
  36.    dbce '/VERSION'
  37.    if version.2 >= 5.00 then do
  38.      if code1='M' then call rdbmenu action1
  39.      object statement
  40.      if dialog.2="OK" then do
  41.        answer='Nop';
  42.        if code2='P' then address command 'PRESS' action2
  43.        if code2='R' then answer=action2; end
  44.      else answer="dbstr='EXIT'"
  45.    End
  46.    else do
  47.  
  48.      'EMSG' prompt
  49.      parse value 'NO' with panel2 code
  50.      parse value rdbui(1) with statement
  51.      if statement<>'' then panel2='OK'; */
  52.    end
  53.  end
  54.  return answer
  55.  
  56.  WELCOME:
  57.  s =   "        Welcome to rDEBUG"lf
  58.  s = s  lf
  59.  s = s "The Integrated Debugger for REXX"lf
  60.  s = s  lf
  61.  s = s "This Demo is completely automated    "lf
  62.  s = s "and requires only that you press     "lf
  63.  s = s "ENTER to continue or select CANCEL   "lf
  64.  s = s "to terminate this demo. Relax, I will"lf
  65.  s = s "make all selections for you.         "lf
  66.  return ,
  67.  'x x! x x !',
  68.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  69.  
  70.  LOG:
  71.  s =   "           SESSION LOG"lf
  72.  s = s  lf
  73.  s = s "This is the previous SESSION LOG   "lf
  74.  s = s "which may be used to recreate      "lf
  75.  s = s "the last session. You may make any "lf
  76.  s = s "changes to it, just enter S (to    "lf
  77.  s = s "SAVE it) then C (to continue),     "lf
  78.  s = s "Note, press F2 to switch to menu   "lf
  79.  s = s "mode from data mode and vice versa "lf
  80.  s = s "I will enter S and C (to Save and  "lf
  81.  s = s "Continue). "lf
  82.  return ,
  83.  'M * 2 7 ! R dbstr = DONE !',
  84.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  85.  
  86.  PROFILE:
  87.  s =   "           YOUR PROFILE"lf
  88.  s = s  lf
  89.  s = s "This screen shows the previous      "lf
  90.  s = s "profile.  Here you would make any   "lf
  91.  s = s "changes to it if you wish to set    "lf
  92.  s = s "various switches, variables and     "lf
  93.  s = s "prefix commands.  I will enter N    "lf
  94.  s = s "(for new default profile).          "lf
  95.  
  96.  return ,
  97.  'M . 3 6 ! R dbstr = NEW !',
  98.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  99.  
  100.  SOURCE:
  101.  s = "        SOURCE PROGRAM or MACRO"lf
  102.  s = s  lf
  103.  s = s "This screen shows your source file "lf
  104.  s = s "and appears only if rDEBUG was     "lf
  105.  s = s "unable to find your file or it     "lf
  106.  s = s "contains certain errors like       "lf
  107.  s = s "unmatched delimiters or has a      "lf
  108.  s = s "'Procedure' statement.  . Here you "lf
  109.  s = s "would make any last-minute changes "lf
  110.  s = s "to the source file, if you wish.   "lf
  111.  s = s "Do so and enter D (DONE to         "lf
  112.  s = s "continue).  I will enter D.        "lf
  113.  
  114.  return ,
  115.  'M . 4 4 ! R dbstr = "DONE" !',
  116.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  117.  
  118.  WELCOME2:
  119.  s =   "         Let's get to work"lf
  120.  s = s  lf
  121.  s = s "This is the main section of rDEBUG.     "lf
  122.  s = s "I will exercise some features of rDEBUG "lf
  123.  s = s "and later we will examine how they went."lf
  124.  s = s "Remember, that these commands can be    "lf
  125.  s = s "entered from the menus also.            "lf
  126.  s = s "First, we will show how to set          "lf
  127.  s = s "breakpoints.                            "lf
  128.  
  129.  return ,
  130.  '. . . . ! R dbstr = "BREAK 2 5-7"  !',
  131.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  132.  
  133.  BREAKPOINTS:
  134.  s =   "       Breakpoints"lf
  135.  s = s  lf
  136.  s = s "Notice, there is a BREAK at   "lf
  137.  s = s "line 2 and a range of BREAKs  "lf
  138.  s = s "on lines 5 through 7. When the"lf
  139.  s = s "program reaches these lines   "lf
  140.  s = s "they will cause a halt in     "lf
  141.  s = s "execution.  Next, we will set "lf
  142.  s = s "a value to a variable.        "lf
  143.  return ,
  144.  'x x! R dbstr="abc = 1" !',
  145.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  146.  
  147.  ASSIGN:
  148.  s =   "       Assignments "lf
  149.  s = s "Caution:  avoid redefining    "lf
  150.  s = s "rDEBUG variables (they start  "lf
  151.  s = s "with 'db').  Next, we will see"lf
  152.  s = s "what the new value is.        "lf
  153.  return ,
  154.  'x x ! R dbstr="SAY abc def dbp"!',
  155.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  156.  
  157.  SHOW:
  158.  s =   "       Show variables "lf
  159.  s = s  lf
  160.  s = s "Notice, that the second       "lf
  161.  s = s "variable is in uppercase, this"lf
  162.  s = s "is because it has not been    "lf
  163.  s = s "defined yet.  The third       "lf
  164.  s = s "variable is a rDEBUG one (it  "lf
  165.  s = s "starts with 'db').  Next, we  "lf
  166.  s = s "will change the flow of       "lf
  167.  s = s "execution.                    "lf
  168.  return ,
  169.  'x x ! R dbstr="GO 7" !',
  170.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  171.  
  172.  GO:
  173.  s =   "        GO COMMAND"lf
  174.  s = s  lf
  175.  s = s "You may GO to any line that  "lf
  176.  s = s "has a ':no', where no is a   "lf
  177.  s = s "line number.  GO or F5 may be"lf
  178.  s = s "used to continue to the next "lf
  179.  s = s "line.  Next, we will set some"lf
  180.  s = s "watchpoints.                 "lf
  181.  return ,
  182.  'x x ! R dbstr="watch abc (def>12)" !',
  183.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  184.  
  185.  WATCH:
  186.  s =   "       WATCH COMMAND"lf
  187.  s = s  lf
  188.  s = s "The first watch is a simple"lf
  189.  s = s "one that generates a"lf
  190.  s = s "breakpoint when it changes"lf
  191.  s = s "value, the second; triggers"lf
  192.  s = s "a halt whenever the expression"lf
  193.  s = s "evaluates as true.  You may"lf
  194.  s = s "use SHIFT+F3 also.  Next, we"lf
  195.  s = s "will show how to single step."lf
  196.  return ,
  197.  'x x ! R dbstr="GO 0" !',
  198.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  199.  
  200.  PROCEDURE:
  201.  s =   "    STEP PROCEDURE COMMAND"lf
  202.  s = s  lf
  203.  s = s "You may also use F10 (Procedure"lf
  204.  s = s "Step Command) to step through"lf
  205.  s = s "procedures.  "lf
  206.  s = s "Next we will run the profiler"lf
  207.  s = s "tool to check the number of  "lf
  208.  s = s "times each instruction line  "lf
  209.  s = s "was executed.                "lf
  210.  return ,
  211.  'x x ! R dbstr="PROFILER " !',
  212.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  213.  
  214.  PROFILER:
  215.  s =   "         PROFILER TOOL COMMAND       "lf
  216.  s = s  lf
  217.  s = s " Notice, the lines at 2-6 were not run."lf
  218.  s = s " However, line 7 was run but not     "lf
  219.  s = s " recorded as such since we jumped to "lf
  220.  s = s " :7 directly.  Next we will terminate"lf
  221.  s = s " this file.                          "lf
  222.  return ,
  223.  '. . . . ! R dbstr = "QQUIT" !',
  224.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  225.  
  226.  FINIS:
  227.  s =   "           EXIT COMMAND"lf
  228.  s = s  lf
  229.  s = s " There you have it, a short demo. "lf
  230.  s = s " Good luck!        "lf
  231.  return ,
  232.  '. . . . ! R dbstr = "EXIT" !',
  233.  "DIALOG /" s "/ TITLE /rDEBUG Demo/ OKCANCEL"
  234.  
  235.  ERROR:    return db9trap(sigl 80e) sourceline(sigl)
  236.  FAILURE:  return db9trap(sigl 80f) sourceline(sigl)
  237.  HALT:     return db9trap(sigl 80h)
  238.  NOTREADY: return db9trap(sigl 80r) sourceline(sigl)
  239.  NOVALUE:  return db9trap(sigl 80v)
  240.  SYNTAX:   return db9trap(sigl 80e) errortext(rc)'~'sourceline(sigl)
  241.  db9TRAP:
  242.  if dbtrc=-7 then dbtrapp=dbtrap
  243.  parse arg dbsigl dbtcode dbtrest
  244.  dbtrap = 0 dbme dbsigl dbtcode dbmsg rdbmsg(dbtcode dbme dbsigl) dbtrest
  245.  dbtrc=-7
  246.  return -7 dbtrapp'~'dbtrap
  247.