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 / gprogs / clrs2pdb.icn < prev    next >
Text File  |  2002-01-24  |  1KB  |  57 lines

  1. ############################################################################
  2. #
  3. #    File:     clrs2pdb.icn
  4. #
  5. #    Subject:  Program to create custom palettes from color lists
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     October 29, 2001
  10. #
  11. ############################################################################
  12. #
  13. #  This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program builds a palette database from color lists.
  18. #
  19. ############################################################################
  20. #
  21. #  Requires:   Version 9 graphics
  22. #
  23. ############################################################################
  24. #
  25. #  Links: basename, palettes, xcode
  26. #
  27. ############################################################################
  28.  
  29. link basename
  30. link palettes
  31. link xcode
  32.  
  33. global PDB_
  34.  
  35. procedure main(args)
  36.    local file, input, clist, line, name
  37.  
  38.     every file := !args do {
  39.        input := open(file) | {
  40.           write(&errout, "*** cannot open ", image(file))
  41.           next
  42.           }
  43.        name := basename(file, ".clr")
  44.        clist := []
  45.        while line := read(input) do {
  46.           line ?:= tab(upto('\t'))
  47.           put(clist, line)
  48.           }
  49.        close(input)
  50.        makepalette(name, clist) |
  51.           write(&errout, "*** could not make palette from ", image(file))
  52.        }
  53.  
  54.     xencode(PDB_, &output)
  55.        
  56. end
  57.