home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / sharew / exoten / icon / usage.icn < prev    next >
Encoding:
Text File  |  1990-03-05  |  1.5 KB  |  56 lines

  1. ############################################################################
  2. #
  3. #    Name:    usage.icn
  4. #
  5. #    Title:    Service procedures
  6. #
  7. #    Author:    Ralph E. Griswold
  8. #
  9. #    Date:    May 11, 1989
  10. #
  11. ############################################################################
  12. #
  13. #     These procedures provide various common services:
  14. #
  15. #     Usage(s)          stops executions with a message concerning the
  16. #                       expected form of usage of a program.
  17. #
  18. #     ErrorCheck(l,f)    reports an error that has been converted to
  19. #                       failure.
  20. #
  21. #     Feature(s)        succeeds if feature s is available in the running
  22. #                       implementation of Icon.
  23. #
  24. #     Requires(s)    terminates execution is feature s is not available.
  25. #
  26. #     Signature()    writes the version, host, and features support in
  27. #                       the running implementation of Icon.
  28. #
  29. ############################################################################
  30.  
  31. procedure Usage(s)
  32.    stop("Usage: ",s)
  33. end
  34.  
  35. procedure ErrorCheck(line,file)
  36.    if &errortext == "" then fail    # No converted error
  37.    write("\nError ",&errornumber," at line ",line, " in file ",file)
  38.    write(&errortext)
  39.    write("offending value: ",image(&errorvalue))
  40.    return
  41. end
  42.  
  43. procedure Feature(s)
  44.    if s == &features then return else fail
  45. end
  46.  
  47. procedure Requires(s)
  48.    if not(Feature(s)) then stop(s," required")
  49. end
  50.  
  51. procedure Signature()
  52.    write(&version)
  53.    write(&host)
  54.    every write(&features)
  55. end
  56.