[Remind-Fans] rem2ps stopped working

Craig B Agricola craig at theagricolas.org
Thu Jul 28 16:24:40 EDT 2005


To follow up, I found the problem.  The root cause is actually
whitespace at the end of your MSG line (I believe).  In the rem2ps code,
the words are broken up by outputting a close paren (end of string in
PostScript) when whitespace is encountered, scanning until you see
non-whitespace, outputing an open paren, and then continuing to copy.
There is a special case for when you encounter whitespace, and then run
into the end of the line before hitting non-whitespace.  It just outputs
the close bracket (end of word array), and uses a 'goto' to continue
with the next entry.  Well, since we still want to output the two
strings of PostScript code that will get executed, we actually don't
want the close bracket.  So, the fix is the attached patch.  Just remove
the close bracket, and we should be happy.  All of this because of
whitespace at the end of your MSG.  :-)

 -Craig

On Thu, Jul 28, 2005 at 03:58:20PM -0400, Craig B Agricola wrote:
> I'm such an ass; I thought I had already sent my findings on this out to
> the list...  The error is actually pretty simple.  If you look at the
> text that goes in the box for a day's reminders, you'll see the words
> broken into separate strings (in PostScript, strings are delimited by
> parens), followed by a close-bracket.  The open and close brackets are
> delimiters of arrays.  On the next line are two empty strings followed
> by a close-bracket.  The problem is caused by the addition of a new
> feature in 03.00.23, which allows rem2ps to add arbitrary PostScript
> code to be called before and then after the text is drawn.  The two
> empty strings on the following line are PostScript code to be
> interpreted at run time.  In all the files that have been sent around,
> these are empty, but they are still supposed to be the last two strings
> in the array of words to be drawn in the box.  The close-bracket after
> the words, which ends the word array, shouldn't be there.  I haven't
> looked at the rem2ps code yet, but I bet that the new feature just
> forgot to suppress the closing bracket before adding the two extra
> strings (and then adding the closing bracket again.)
> 
>  -Craig
> 
> On Thu, Jul 28, 2005 at 08:31:58PM +0200, Ren?? van Bevern wrote:
> > On 15.07.05, Craig B Agricola wrote:
> > 
> > Hi.
> > 
> > > PostScript is a guilty pleasure for me, so feel free to send me the
> > > output of rem2ps and I'll see if I can figure out what might be wrong
> > > with it.
> > 
> > I append a working PostScript file as generated by rem2ps 03.00.22 and a
> > diff to a broken PostScript file as generated by rem2ps 03.00.23.
> > 
> > The problem is definitively caused by rem2ps 03.00.23. Merely exchanging
> > it by rem2ps 03.00.22 works in this case.
> > 
> > As I have very little or no understanding of PostScript, I'd very much
> > appreaciate your help. :)
> > 
> >     Ren?? van Bevern,
> >       http://progn.org
> 
> 
> > --- ps2.ps	2005-07-28 19:18:21.000000000 +0200
> > +++ ps1.ps	2005-07-28 19:18:13.000000000 +0200
> > @@ -165,8 +165,22 @@
> >     /width exch def
> >     /xleft exch def
> >     /curline () def
> > +   % The last two strings in the word array are actually the PostScript
> > +   % code to execute before and after the entry is printed.
> > +   dup dup
> > +   length 1 sub
> > +   get
> > +   exch
> > +   dup dup
> > +   length 2 sub
> > +   get
> > +   dup length 0 gt
> > +   {cvx exec} {pop} ifelse
> > +   dup length 2 sub 0 exch getinterval
> >     {EnterOneWord} forall
> >     FinishFormatting
> > +   dup length 0 gt
> > +   {cvx exec} {pop} ifelse
> >     y
> >  } bind def
> >  % Variables for calendar boxes:
> > @@ -357,6 +371,7 @@
> >  Border ytop 5 xincr mul MinX add xincr
> >  [
> >    [(Chuck's)(17th)(birthday)]
> > +()()]
> >  ]
> >  (15)
> >  DoCalBox
> > @@ -366,6 +381,7 @@
> >  Border ytop 6 xincr mul MinX add xincr
> >  [
> >    [(Dom's)(32nd)(birthday)]
> > +()()]
> >  ]
> >  (16)
> >  DoCalBox
> 
> 
> 
-------------- next part --------------
diff -urw remind-03.00.23.orig/src/rem2ps.c remind-03.00.23/src/rem2ps.c
--- remind-03.00.23.orig/src/rem2ps.c	2005-04-11 21:07:32.000000000 -0400
+++ remind-03.00.23/src/rem2ps.c	2005-07-28 16:16:29.000000000 -0400
@@ -643,7 +643,7 @@
 	    PutChar(')');
 	    while(isspace((unsigned char)*s)) s++;
 	    if (!*s) {
-		printf("]\n");
+		printf("\n");
 		goto finish;
 	    }
 	    PutChar('(');


More information about the Remind-fans mailing list