home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gprocs / fetchpat.icn < prev    next >
Text File  |  2000-07-29  |  1KB  |  46 lines

  1. ############################################################################
  2. #
  3. #    File:     fetchpat.icn
  4. #
  5. #    Subject:  Procedure to fetch a pattern specification
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     October 21, 1993
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This procedure fetches a pattern by number from a file of pattern
  18. #  specifications.  It fails if the file does not exist or does not
  19. #  contain that many pattern specifications.
  20. #
  21. #  The file is searched for in the current directory first, then using
  22. #  DPATH.
  23. #
  24. ############################################################################
  25. #
  26. #  Links:  io, patutils
  27. #
  28. ############################################################################
  29.  
  30. link io
  31. link patutils
  32.  
  33. procedure fetchpat(file, n)
  34.    local input, pattern
  35.  
  36.    input := dopen(file) | fail
  37.  
  38.    every 1 to n do
  39.       pattern := readpatt(input)
  40.  
  41.    close(file)
  42.  
  43.    return \pattern
  44.  
  45. end
  46.