summaryrefslogtreecommitdiff
path: root/ipl/gpacks/weaving/wif2pfd.icn
blob: 73669444c389e1eb1e2cb22a9604d91c544c70c7 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
############################################################################
#
#	File:     wif2pfd.icn
#
#	Subject:  Program to convert WIFs to PFDs
#
#	Author:   Ralph E. Griswold
#
#	Date:     June 13, 1999
#
############################################################################
#
#  This file is in the public domain.
#
############################################################################
#
#  The following options are supported:
#
#	-p s	palette; default "c1"
#	-n s	name; default "untitled"
#
#  Note:  The output is a pattern-form draft with the following lines:
#
#	name
#	threading sequence
#	treadling sequence
#	warp color sequence
#	weft color sequence
#	shafts
#	treadles
#	palette
#	colors
#	tieup
#	liftplan
#
#  There is a problem where there is treadling with multiple treadles
#  and no liftplan.  *Presumably* that treadling can be used like a
#  liftplan, but without, necessarily, a direct tie-up.  This problem
#  problem has not been addressed yet.
#
#  If there is a liftplan, then a direct tie-up is implied by the
#  wording in the WIF documentation.  However, that's in the interpretation
#  of the draft.  The tie-up produced here is the one given in the
#
#  If there is a liftplan and a treadling with multiple treadles,
#  the treadling is ignored.
#
#  Also not handled is the possibility of multiple shafts per thread.
#  This could be dealt with as for the liftplan.  The idea is that
#  instead of a threading corresponding to a single shaft, there are
#  some number of different shaft patterns, like there are liftplan
#  patterns.
#
#  The liftplan is represented as concatenated rows of shaft patterns in the
#  irder they first appear.  Thus, the symbols used for them can be
#  reconstructed with the PFD is processed.
#
#  This program does not attempt to detect or correct errors in WIFs,
#  but it does try to work around some common problems.
#
############################################################################
#
#  Links:  options, wifcvt
#
############################################################################

link options
link wifcvt

global data_default
global data_entries
global sections
global wif

procedure main(args)
   local opts, title, palette

   opts := options(args, "n:p:")

   title := \opts["n"] | "untitled"
   palette := \opts["p"] | "c1"

   writepfd(&output, wif2pfd(&input, title, palette))

end