home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / postscri / 6118 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.4 KB  |  36 lines

  1. Newsgroups: comp.lang.postscript
  2. Path: sparky!uunet!world!pd
  3. From: pd@world.std.com (Peter F Davis)
  4. Subject: Re: problem manipulating binary data in postscript
  5. Message-ID: <C00xu7.3qn@world.std.com>
  6. Organization: The World Public Access UNIX, Brookline, MA
  7. References: <1992Dec28.171257.27785@news2.cis.umn.edu>
  8. Date: Tue, 29 Dec 1992 14:06:07 GMT
  9. Lines: 25
  10.  
  11. cahoon@femto.cs.umn.edu (Forrest Clinton Cahoon) writes:
  12.  
  13. >I'm trying to write some postscript which will color a hexagonal grid,
  14. >reading the color data from the end of my ps file.  I'm reading one
  15. >byte for each hexagon, then doing some bit-twiddling to get values to call
  16. >setrgbcolor with before filling the hexagon.
  17.  
  18. >I've got a version using "read" which works, but since "read" treats my
  19. >newline characters as valid binary data, it's not entirely
  20. >satisfactory.
  21.  
  22. >What I want to use is "readhexstring", but since what this reads in is
  23. >treated as a string rather than an integer, I'm having trouble.  I
  24. >need to convert my one-byte string into an integer having the same
  25. >binary representation.  I don't want "cvi", because this parses a
  26. >string which represents an integer to us humans, and puts that value
  27. >on the stack -- cvi would read (1) and put the integer value 1 on the
  28. >stack, but what I need would take (1) and put the integer value 49 --
  29. >the ASCII value of the character 1 -- on the stack.
  30.  
  31. Use 'get' to get any byte from the string as an integer:
  32.  
  33.     (A) 0 get
  34.  
  35. will put 65 on the stack.
  36.