Article View: comp.lang.postscript
Article #5843problem manipulating binary data in postscript
From: Forrest Clinton Cahoon
Date: Mon, 28 Dec 1992 17:12
Date: Mon, 28 Dec 1992 17:12
22 lines
1701 bytes
1701 bytes
I'm trying to write some postscript which will color a hexagonal grid, reading the color data from the end of my ps file. I'm reading one byte for each hexagon, then doing some bit-twiddling to get values to call setrgbcolor with before filling the hexagon. I've got a version using "read" which works, but since "read" treats my newline characters as valid binary data, it's not entirely satisfactory. What I want to use is "readhexstring", but since what this reads in is treated as a string rather than an integer, I'm having trouble. I need to convert my one-byte string into an integer having the same binary representation. I don't want "cvi", because this parses a string which represents an integer to us humans, and puts that value on the stack -- cvi would read (1) and put the integer value 1 on the stack, but what I need would take (1) and put the integer value 49 -- the ASCII value of the character 1 -- on the stack. -- | Forrest Cahoon | cahoon@cs.umn.edu |------------------------------| | 850 21st Ave SE |-------------------| Only unbalanced people | | Mpls MN 55414-2514 | | can tip the scales... |
Technical Details
Message-ID:
<1992Dec28.171257.27785@news2.cis.umn.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!femto!cahoonShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!femto!cahoon From: cahoon@femto.cs.umn.edu (Forrest Clinton Cahoon) Subject: problem manipulating binary data in postscript Message-ID: <1992Dec28.171257.27785@news2.cis.umn.edu> Sender: news@news2.cis.umn.edu (Usenet News Administration) Nntp-Posting-Host: femto.cs.umn.edu Organization: University of Minnesota, Minneapolis, CSci dept. Date: Mon, 28 Dec 1992 17:12:57 GMT Lines: 22