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
/
progs
/
splitlit.icn
< prev
next >
Wrap
Text File
|
2000-07-29
|
1KB
|
55 lines
############################################################################
#
# File: splitlit.icn
#
# Subject: Program to create string literal
#
# Author: Ralph E. Griswold
#
# Date: September 15, 1993
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# The idea is to create a string literal with continuations in case
# it's too long.
#
# The options are:
#
# -w i width of piece on line, default 50
# -i i indent, default 3
#
############################################################################
#
# Links: options
#
############################################################################
link options
procedure main(args)
local width, line, chunk, opts, prefix, indent
opts := options(args, "w+i+")
width := \opts["w"] | 50
indent := \opts["i"] | 3
prefix := repl(" ", indent)
while line := read() do {
line ? {
writes(prefix, "\"")
while chunk := move(50) do {
write(image(chunk)[2:-1], "_")
writes(prefix)
}
write(image(tab(0))[2:-1], "\"")
}
}
end