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
|
############################################################################
#
# File: imstogif.icn
#
# Subject: Program to convert image strings to GIF files
#
# Author: Ralph E. Griswold
#
# Date: June 23, 2000
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# This program converts image strings whose names are given on the command
# line to GIF files. Image files are expected to have the suffix .ims.
#
# The GIF files are written to files with the basenames of the image string
# files and the suffix "gif".
#
# The following option is supported:
#
# -l read Icon literal instead of plain string
#
############################################################################
#
# Requires: Version 9 graphics
#
############################################################################
#
# Links: basename, graphics, imrutils, options, strings
#
############################################################################
link basename
link graphics
link imrutils
link options
link strings
procedure main(args)
local file, opts, name, imr, input, literal
opts := options(args, "l")
literal := opts["l"] # NOT YET IMPLEMENTED
every file := !args do {
name := basename(file, ".ims") || ".gif"
input := open(file) | {
write(&errout, "*** can't open ", file)
next
}
imr := imstoimr(read(input)) | {
write(&errout, "*** bad image file: ", file)
next
}
imropen(imr) | stop("*** bad image file: ", file)
close(input)
WriteImage(name)
WClose()
}
end
|