summaryrefslogtreecommitdiff
path: root/ipl/gprocs/pattread.icn
blob: d9613d59b6bad5c109fc58f8921539ef593ed577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
############################################################################
#
#	File:     pattread.icn
#
#	Subject:  Procedure to read pattern
#
#	Author:   Ralph E. Griswold
#
#	Date:     December 10, 2001
#
############################################################################
#
#  This file is in the public domain.
#
############################################################################
#
#  Reads BLP or row file and produces pattern in row form.
#
############################################################################
#
#  Links:  patutils
#
############################################################################

link patutils

procedure pattread(file)
   local line, rows

   line := read(file) | fail

   line ? {
      if upto("#", line) then rows := pat2rows(line)
      else {
         rows := [line]
         while put(rows, read(file))	# read in row pattern
         }
      }

   return rows

end