summaryrefslogtreecommitdiff
path: root/ipl/gprogs/fmap2pdb.icn
blob: 91709b9d977474b69b6f5b587b6b479d91d70b78 (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
############################################################################
#
#	File:     fmap2pdb.icn
#
#	Subject:  Program to create custom palettes from color maps
#
#	Author:   Ralph E. Griswold
#
#	Date:     May 15, 2000
#
############################################################################
#
#  This file is in the public domain.
#
############################################################################
#
#  This program builds a palette database from Fracting color maps.
#
############################################################################
#
#  Requires:   Version 9 graphics
#
############################################################################
#
#  Links: basename, palettes, xcode
#
############################################################################

link basename
link palettes
link xcode

global PDB_

procedure main(args)
   local file, input, clist, color, line, name

    every file := !args do {
       input := open(file) | {
          write(&errout, "*** cannot open ", image(file))
          next
          }
       name := basename(file, ".map")
       clist := []
       while line := read(input) do {
          line ? {
             tab(upto(&digits))
             color := (tab(many(&digits)) * 257) || ","
             tab(upto(&digits))
             color ||:= (tab(many(&digits)) * 257) || ","
             tab(upto(&digits))
             color ||:= (tab(many(&digits)) * 257)
             }
          put(clist, color)
          }
       close(input)
       makepalette(name, clist) |
          write(&errout, "*** could not make palette from ", image(file))
       }

    xencode(PDB_, &output)
       
end