home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / extras / ttx / rexx / ttx_sasc / CPR.ttx < prev    next >
Encoding:
Text File  |  1996-12-24  |  1.0 KB  |  39 lines

  1. /*
  2. **  $VER: CPR.ttx 2.1 (17.8.93)
  3. **      By Kenneth Yarnall.  This code may be freely distributed.
  4. **
  5. **   Starts CPR on an executable, that is assumed to exist in the same
  6. ** directory as the current file, and whose name is gotten by stripping
  7. ** the '.c'or '.cpp' or whatever off the current filename.
  8. **   Accepts one command line argument, mode, which should be either 'wb'
  9. ** or 'cli', and is used to determine what sort of environment the program
  10. ** is debugged in.
  11. */
  12.  
  13. Options RESULTS
  14.  
  15. parse arg mode  /* Get the mode from the command line */
  16.  
  17. GetFilePath     /*  Gets the complete path+filename for the current doc */
  18. path = RESULT
  19.  
  20. dotpos = LastPos('.', path)
  21. if dotpos ~= 0 then do
  22.     ext = SubStr(path, dotpos+1)
  23.     if ext ~= 'c' & ext ~= 'cpp' & ext ~= 'cxx' then do
  24.         SetStatusBar "Must be editing a C file"
  25.         exit 10
  26.     end
  27. end
  28. else do
  29.     SetStatusBar "Must be editing a C file"
  30.     exit 10
  31. end
  32.  
  33. executable = Left(path, dotpos-1)
  34.  
  35. /* Pass the CPR commandline to the shell */
  36.  
  37. Address 'COMMAND'
  38. 'run cpr -' || mode || ' ' || executable
  39.