############################################################################ # # File: twill.icn # # Subject: Program # # Author: Ralph E. Griswold # # Date: January 21, 2000 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # Procedure to convert twill tie-up specification to pattern # ############################################################################ # # Links: patutils # ############################################################################ link patutils procedure twill_tieup(pattern, shift) local row, i, rows, count count := 1 # off/even over/under toggle row := "" pattern ? { while ="/" do { i := tab(many(&digits)) | fail row ||:= repl(count, i) count +:= 1 count %:= 2 } if not pos(0) then fail } if *row < 2 then fail rows := [] put(rows, row) every i := 1 to *row - 1 do put(rows, row := rotate(row, shift)) return rows2pat(rows) end