Article View: comp.lang.postscript
Article #6404Re: Simpleton question (how to use "cvs")
From: Gilles R. Detillieux
Date: Wed, 26 Jun 1991 21:20
Date: Wed, 26 Jun 1991 21:20
24 lines
1820 bytes
1820 bytes
In <28678BF9.4393@maccs.dcss.mcmaster.ca> dan@maccs.dcss.mcmaster.ca (Dan Trottier) writes:
>I'm trying to write a postscript program to dump character width tables
>and print them on the printer. The following code segment works except
>I can't seem to print the numeric width:
>/prtchar
>{ char 0
> 3 -1 roll put char dup == - puts char to standard out
> dup show - puts char to page
> stringwidth pop 300 mul 72 div - calculate width
> round cvi dup == - round and put to stdout
> dup cvs show - now how do I display width
> } def to page???? Doesn't work!
The cvs operator must be given a string, which will be overwritten with the
result. The usage is: <any> <string> cvs => <substring>
So in your code, you should preallocate a string buffer (outside of the
prtchar procedure): /str 20 string def
then change the last line in prtchar to: dup str cvs show
(the dup is needed only if prtchar is supposed to leave the width on the stack).
--
Gilles Detillieux <Gilles@scrc.UManitoba.CA>
Spinal Cord Research Centre or <grdetil@ccu.UManitoba.CA>
Dept. of Physiology, U. of Manitoba Phone: (204)788-6766
Winnipeg, MB R3E 0W3 (Canada) Fax: (204)786-0932
Technical Details
Message-ID:
<1991Jun26.212022.16500@ccu.umanitoba.ca>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lll-winken!aunro!alberta!herald.usask.ca!ccu.umanitoba.ca!grdetilReferences:
<28678BF9.4393@maccs.dcss.mcmaster.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lll-winken!aunro!alberta!herald.usask.ca!ccu.umanitoba.ca!grdetil From: grdetil@ccu.umanitoba.ca (Gilles R. Detillieux) Newsgroups: comp.lang.postscript Subject: Re: Simpleton question (how to use "cvs") Message-ID: <1991Jun26.212022.16500@ccu.umanitoba.ca> Date: 26 Jun 91 21:20:22 GMT References: <28678BF9.4393@maccs.dcss.mcmaster.ca> Distribution: na Organization: University of Manitoba, Winnipeg, Canada Lines: 24