R-alpha: minor problems with multiple page PS files

George White (gwhite@cabot.bio.dfo.ca)
Thu, 21 Nov 96 16:53:13 AST


Message-Id: <199611212054.VAA21907@hypatia.math.ethz.ch>
From: George White <gwhite@cabot.bio.dfo.ca>
Subject: R-alpha: minor problems with multiple page PS files
To: r-testers@stat.math.ethz.ch
Date: Thu, 21 Nov 96 16:53:13 AST

R-0.13 has some minor problems with multiple page PS files.  As it 
stands, I only get to see the 1st page in ghostview (2.7.6 on unix, 2.1
on OS/2).  This can be fixed by a quick hack, but there is still a
problem moving back and forth between pages.  If I have a several page
landscape PS file, everthing works when I go thru the 1st time, but 
if I go back to the 1st page, it is rotated 90 degrees, so you are
not able to see the entire plot on the page.  Pages 2,... are OK.  I
suspect the grestore/save commands are not being put in the right 
place.  The changes that enable me to get beyond page 1 are:

$ diff -c devPS.c*
*** devPS.c     Thu Nov 21 16:36:23 1996
--- devPS.c.orig        Thu Nov 21 16:14:48 1996
***************
*** 1,6 ****
- /* patched to produce sequential page numbers and avoid confusing
- ** ghostview.  George White <gwhite@bionet.bio.dfo.ca>
- */
  /*
   *  R : A Computer Langage for Statistical Data Analysis
   *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
--- 1,3 ----
***************
*** 215,221 ****
  {
        int face, size;
        if(pageno > 1) {
!               /* ++pageno; */
                fprintf(psfp, "showpage\n");
                fprintf(psfp, "%%%%Page: %d %d\n", pageno, pageno);
                fprintf(psfp, "grestore gsave\n");
  {
        int face, size;
        if(pageno > 1) {
!               ++pageno;
                fprintf(psfp, "showpage\n");
                fprintf(psfp, "%%%%Page: %d %d\n", pageno, pageno);
                fprintf(psfp, "grestore gsave\n");
***************
*** 225,232 ****
                fontsize = 0;
                SetFont(face, size);
                ClearPage();
!       } /* else pageno++; */
!    pageno++;
  }

        /* Close down the driver */
***************
*** 235,241 ****
  {
        fprintf(psfp, "showpage\n");
        fprintf(psfp, "%%%%Trailer\n");
!       fprintf(psfp, "%%%%Pages: %d\n", pageno-1);
        fclose(psfp);
  }

--- 231,237 ----
  {
        fprintf(psfp, "showpage\n");
        fprintf(psfp, "%%%%Trailer\n");
!       fprintf(psfp, "%%%%Pages: %d\n", pageno);
        fclose(psfp);
  }

The final "pageno-1" is purely empirical, as I don't understand how
pageno gets to be "2" when you have only one call to plot.




--
  George N. White III                | Internet: <aa056@chebucto.ns.ca>
  Department of Fisheries and Oceans | DFO email: GWhite@BIOnet.BIO.DFO.ca
  Ocean Sciences Division            | Time Zone: Atlantic (AST4ADT)
  Bedford Institute of Oceanography  | phone: (08:00-16:00)
  P.O. Box 1006                      |     902.426.8509 (office)
  Dartmouth, Nova Scotia             |     902.426.9388 (FAX)
  CANADA               B2Y 4A2       |     902.426.3793 (emergencies)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-