Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Helge Blischke Newsgroups: comp.lang.postscript Subject: Re: Unbalanced [ Followup-To: comp.lang.postscript Date: Thu, 12 Sep 2013 11:31:13 +0200 Lines: 61 Message-ID: References: <86272e7d-88ce-4adb-ba92-3424ec5e89ca@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit X-Trace: individual.net vRpUK1M+Ou50EodC+o/AsgXtfdBk3JbDIgdiDR3tr5Jd1rNIxH Cancel-Lock: sha1:+c8dsJragxKUbLf8jU7Itwb7uyw= User-Agent: KNode/0.99.01 Xref: csiph.com comp.lang.postscript:1620 luser- -droog wrote: > On Wednesday, September 11, 2013 11:16:13 AM UTC-5, ana...@gmail.com > wrote: >> Hi everyone, >> >> I am writing a PostScript interpreter for a product I sell, and while >> working with some sample .EPS files, I ran into the following: >> >> /xpdfm >> { >> { >> dup 0 get/Label eq >> { >> aload length[exch 1 add 1 roll/PAGELABEL >> }{ >> aload pop >> [{ThisPage}<<5 -2 roll>>/PUT >> }ifelse >> pdfmark_5 >> }forall >> >> >> This code snippet contains two unbalanced opening square brackets ([). >> >> Is this normal? How should this be treated by a PostScript interpreter? >> >> Thanks in advance. >> > > As others have said, the left bracket [ is defined in systemdict as a > marktype object (same as the name /mark). Since only one of the procedure- > bodies passed to ifelse will be executed, there is really only one mark > without a matching right bracket ]. This style is used in much the same > way as a vararg function in C, to pass an open-ended set of values, > presumably to pdfmark_5. I'm not familiar with the '_5' part, but pdfmark > is used to pass data into a generated pdf file. > > If your output device is not a pdf-writer, you can probably safely > define > > /pdfmark { cleartomark } def > > By the way, the << is also a mark, so you will sometimes see [ used > instead. > > [ /this (is) /a (dictionary) >> The ample snippet is from the prolog section Acrobat (Adobe Reader as well) generates when printing to PostScript printers, and /pdfmark_5 is there defined like: /currentdistillerparams where{pop currentdistillerparams/CoreDistVersion get 5000 lt}{true}ifelse { /pdfmark_5{cleartomark}bind def }{ /pdfmark_5{pdfmark}bind def }ifelse Helge