langford@reed.UUCP (Chris Langford) (04/13/88)
About a month ago, I asked the net for some help concerning data presentation I have a program that digitally samples 2 channels of analog data and saves it in 8-bit form. The data are interleaved (chan1, chan2, chan1, chan2, etc.) I then wrote a PostScript program that took the data in array form, and printed it on a LaserWriter. This was not the most efficient way to go about the process, and the net helped (especially Glenn Reid and Mike Byron at Adobe, and Danny K. Llewallyn, for the currentfile help) a great deal, by demonstrating the 'read' command. I got the program to work fine, until yesterday, when I downloaded a version that had worked previously. It simply stopped working. I went back to an archived copy of the program, and it worked fine. I then copied the program from the archived file to some new data, *word-for-word*, and tried to print it; it wouldn't work. I use SPS 1.21 (thanks again to Glenn), So I know where the problem occurs: I have a procedure, initialstate, that sets up the page before the data is read in and printed. This procedure is listed below: /initialstate { % def save <<< This gets done. /xval 0 def <<< This gets done. /tx 0 def <<< This gets done. 300dpi dup scale <<< This gets done. 350 ysf 300 mul 3100 exch sub translate <<< This is where it dies. /ld 0 def 0 setlinewidth 1 setlinecap /y1 0 def /y2 0 def gsave gsave } def Initialstate is called by the main procedure, readbinaryfile, which is called once, followed by the binary data to be printed: /readbinaryfile { % def initialstate <<<<<< It's called here. { % bind loop /rn 0 def thecount { % repeat currentfile read not {/thecount rn def /eof true def exit} if /rn rn 1 add def } repeat %% more procedures to print out the data that follows the prolog. %%EndProlog readbinaryfile %% 12 K worth of ascii code that is read by the readbinaryfile %% procedure. I start to download the file, wait about 2 minutes, then get a typecheck error, offending command: mul. The stack contains 2 -savelevel- 2 is the value of ysf (a number used to set the y-scale factor) Apparently the interpreter gets to the point where initialstate is called, does the save, does the first couple of definitions, does the scale (300dpi is defined earlier), and then chokes on the translate command. It is as if the literal number 350 is *not* put on the stack, the value of ysf *is* put on the stack, and the number 300 is *not* put on the stack, and the mul causes a typecheck error. I know that this is the place in the program where the error occurs because when I substitute different values for ysf, the number on the top of the stack matches it. Can anybody out there give me a clue as to why these numbers are not being pushed onto the stack? Can anybody tell me why the archived copy works, and when I try to add different data, it doesn't? The data in both cases were collected the same way, and are in the same format, and everything. Only the numbers themselves are different. Any help would be appreciated. Chris Langford Reed College Biology Dept. UUCP: {decvax allegra ucbcad ucbvax hplabs ihnp4}!tektronix!reed!langford