home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Tools / Preditor 2.0 / Macros / ShowLine < prev    next >
Encoding:
Text File  |  1991-07-26  |  851 b   |  45 lines  |  [TEXT/TCEd]

  1. #
  2. #    ShowLine
  3. #
  4. #    Last Modified: Friday, June 27, 1991 at 11:46 PM
  5. #    Macro Files for Preditor
  6. #
  7. #    Show a specific line in a file.  Uses the current selection
  8. #    from the file ~1 as input - and expects the format to be:
  9. #
  10. #    File "hello.c"; Line 100    # Comment
  11. #
  12. #    This macro is mainly used to execute Preditor and MPW
  13. #    error statements.
  14. #
  15. #    © Copyright Evatac Software  1988-1991
  16. #    All rights reserved
  17. #
  18.  
  19. /* First, get the file name/path name */
  20.  
  21. Select([§]≤0, ~1)
  22. Search("", "File ", NULL, ~1)
  23. Select([§]≥0, ~1)
  24. Search("p", "[^\\"]*", NULL, ~1)
  25. filename = Select(§, ~1)
  26.  
  27. /* Get the line #, if any */
  28.  
  29. If (Select([§]≥2:[§]≥1, ~1) == ";")
  30.     Search("p", "[0-9]+", NULL, ~1)
  31.     lineNumber = Select(§, ~1)
  32. Else
  33.     lineNumber = 0
  34. End
  35.  
  36. /* Open the file and scroll to the line number */
  37.  
  38. Open(filename, "a")
  39. If (lineNumber != 0)
  40.     Select(%lineNumber, ~Active)
  41. End
  42.  
  43.  
  44.  
  45.