summaryrefslogtreecommitdiff
path: root/ipl/gpacks/weaving/wvp2html.icn
blob: 4ce26efb12968cf21694a2e9af3541437920b2a9 (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
############################################################################
#
#	File:     wvp2html.icn
#
#	Subject:  Program to create web pages for WVP weaving images
#
#	Author:   Ralph E. Griswold
#
#	Date:     June 19, 1999
#
############################################################################
#
#  This file is in the public domain.
#
############################################################################
#
#  AD HOC.  Skeleton was derived from a CyberStudio page.  Images are
#  assumed to be 128x128.
#
#  The name of a directory, <d> is given on the command line.  The .wvp
#  files are expected in WVP/<d>/*.wvp and the image files in GIF/<d>/*.gif
#
#  The pages are written to HTML/<d>/<name>.html.  If this subdirectory
#  does not exist, it is created.
#
############################################################################
#
#  Links:  basename
#
############################################################################

link basename

procedure main(args)
   local page, i, directory, name, input, output, files

   $include "wvppage"

   directory := args[1] | stop("*** no directory given")

   files := open("ls WVP/" || directory || "/*.wvp", "p")

   system("mkdir HTML/" || directory || " 2>/dev/null")

   while name := read(files) do {
      name := basename(name, ".wvp")
      page[6] := name
      page[30] := image(" ../../GIF/" || directory || "/" || name || ".gif")
      output := open("HTML/" || directory || "/" || name || ".html", "w") |
         stop("*** cannot open page for writing")
      every write(output, page[1 to 33])
      input := open("WVP/" || directory || "/" || name || ".wvp") |
         stop("*** cannot open .wvp file")
      while write(output, read(input))
      every write(output, page[35 to *page])
      close(input)
      close(output)
      }

end