Path: 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 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: cvs => 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 Spinal Cord Research Centre or Dept. of Physiology, U. of Manitoba Phone: (204)788-6766 Winnipeg, MB R3E 0W3 (Canada) Fax: (204)786-0932