🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: vmsnet.sources
Article #22

Ghostview for VMS 12/14

#22
From: Terry Poot
Date: Thu, 29 Oct 1992 18:50
1334 lines
49174 bytes
Submitted-by: Terry Poot <tp@mccall.com>
Posting-number: Volume 3, Issue 230
Archive-name: ghostview/part12

-+-+-+-+-+-+-+-+ START OF PART 12 -+-+-+-+-+-+-+-+
X`09`09while (cp = gettext(next_char, &next_char)) `7B
X`09`09    doc->media = (struct documentmedia *)
X`09`09`09`09 realloc(doc->media,
X`09`09`09`09`09 (doc->nummedia+1)*
X`09`09`09`09`09 sizeof (struct documentmedia));
X`09`09    if (doc->media == NULL) `7B
X`09`09`09fprintf(stderr,
X`09`09`09`09"Fatal Error: Dynamic memory exhausted.\n");
X`09`09`09exit(-1);
X`09`09    `7D
X`09`09    doc->media`5Bdoc->nummedia`5D.name = cp;
X`09`09    doc->media`5Bdoc->nummedia`5D.width = 0;
X`09`09    doc->media`5Bdoc->nummedia`5D.height = 0;
X`09`09    for (dmp=papersizes; dmp->name != NULL; dmp++) `7B
X`09`09`09/* Note: Paper size comment uses down cased paper size
X`09`09`09 * name.  Case insensitive compares are only used for
X`09`09`09 * PaperSize comments.
X`09`09`09 */
X`09`09`09if (strcasecmp(doc->media`5Bdoc->nummedia`5D.name,
X`09`09`09`09   dmp->name) == 0) `7B
X`09`09`09    doc->media`5Bdoc->nummedia`5D.width = dmp->width;
X`09`09`09    doc->media`5Bdoc->nummedia`5D.height = dmp->height;
X`09`09`09    break;
X`09`09`09`7D
X`09`09    `7D
X`09`09    if (doc->media`5Bdoc->nummedia`5D.width != 0 &&
X`09`09`09doc->media`5Bdoc->nummedia`5D.height != 0) doc->nummedia++;
X`09`09    else
X`09`09`09free(doc->media`5Bdoc->nummedia`5D.name);
X`09`09`7D
X`09    `7D
X`09    section_len += line_len;
X`09    if (doc->nummedia != 0) doc->default_page_media = doc->media;
X`09`7D
X    `7D
X
X    if (iscomment(line, "%%EndComments")) `7B
X`09readline(line, sizeof line, file, &position, &line_len);
X`09section_len += line_len;
X    `7D
X    doc->endheader = position;
X    doc->lenheader = section_len - line_len;
X
X    /* Optional Preview comments for encapsulated PostScript files */`20
X
X    while (isblank(line) &&
X`09   readline(line, sizeof line, file, &position, &line_len)) `7B
X    `7D
X
X    if (doc->epsf && iscomment(line, "%%BeginPreview")) `7B
X`09doc->beginpreview = position;
X`09section_len = line_len;
X`09while (readline(line, sizeof line, file, &position, &line_len) &&
X`09       !iscomment(line, "%%EndPreview")) `7B
X`09    section_len += line_len;
X`09`7D
X`09section_len += line_len;
X`09readline(line, sizeof line, file, &position, &line_len);
X`09section_len += line_len;
X`09doc->endpreview = position;
X`09doc->lenpreview = section_len - line_len;
X    `7D
X
X    /* Page Defaults for Version 3.0 files */
X
X    while (isblank(line) &&
X`09   readline(line, sizeof line, file, &position, &line_len)) `7B
X    `7D
X
X    if (iscomment(line, "%%BeginDefaults")) `7B
X`09doc->begindefaults = position;
X`09section_len = line_len;
X`09while (readline(line, sizeof line, file, &position, &line_len) &&
X`09       !iscomment(line, "%%EndDefaults")) `7B
X`09    section_len += line_len;
X`09    if (!iscomment(line, "%%")) `7B
X`09`09/* Do nothing */
X`09    `7D else if (doc->default_page_orientation == NONE &&
X`09`09iscomment(line+2, "PageOrientation:")) `7B
X`09`09sscanf(line+length("%%PageOrientation:"), "%s", text);
X`09`09if (strcmp(text, "Portrait") == 0) `7B
X`09`09    doc->default_page_orientation = PORTRAIT;
X`09`09`7D else if (strcmp(text, "Landscape") == 0) `7B
X`09`09    doc->default_page_orientation = LANDSCAPE;
X`09`09`7D
X`09    `7D else if (page_media_set == NONE &&
X`09`09       iscomment(line+2, "PageMedia:")) `7B
X`09`09cp = gettext(line+length("%%PageMedia:"), NULL);
X`09`09for (dmp = doc->media, i=0; i<doc->nummedia; i++, dmp++) `7B
X`09`09    if (strcmp(cp, dmp->name) == 0) `7B
X`09`09`09doc->default_page_media = dmp;
X`09`09`09page_media_set = 1;
X`09`09`09break;
X`09`09    `7D
X`09`09`7D
X`09`09free(cp);
X`09    `7D else if (page_bb_set == NONE &&
X`09`09       iscomment(line+2, "PageBoundingBox:")) `7B
X`09`09if (sscanf(line+length("%%PageBoundingBox:"), "%d %d %d %d",
X`09`09`09   &(doc->default_page_boundingbox`5BLLX`5D),
X`09`09`09   &(doc->default_page_boundingbox`5BLLY`5D),
X`09`09`09   &(doc->default_page_boundingbox`5BURX`5D),
X`09`09`09   &(doc->default_page_boundingbox`5BURY`5D)) == 4)
X`09`09    page_bb_set = 1;
X`09`09else `7B
X`09`09    float fllx, flly, furx, fury;
X`09`09    if (sscanf(line+length("%%PageBoundingBox:"), "%f %f %f %f",
X`09`09`09       &fllx, &flly, &furx, &fury) == 4) `7B
X`09`09`09page_bb_set = 1;
X`09`09`09doc->default_page_boundingbox`5BLLX`5D = fllx;
X`09`09`09doc->default_page_boundingbox`5BLLY`5D = flly;
X`09`09`09doc->default_page_boundingbox`5BURX`5D = furx;
X`09`09`09doc->default_page_boundingbox`5BURY`5D = fury;
X`09`09`09if (fllx < doc->default_page_boundingbox`5BLLX`5D)
X`09`09`09    doc->default_page_boundingbox`5BLLX`5D--;
X`09`09`09if (flly < doc->default_page_boundingbox`5BLLY`5D)
X`09`09`09    doc->default_page_boundingbox`5BLLY`5D--;
X`09`09`09if (furx > doc->default_page_boundingbox`5BURX`5D)
X`09`09`09    doc->default_page_boundingbox`5BURX`5D++;
X`09`09`09if (fury > doc->default_page_boundingbox`5BURY`5D)
X`09`09`09    doc->default_page_boundingbox`5BURY`5D++;
X`09`09    `7D
X`09`09`7D
X`09    `7D
X`09`7D
X`09section_len += line_len;
X`09readline(line, sizeof line, file, &position, &line_len);
X`09section_len += line_len;
X`09doc->enddefaults = position;
X`09doc->lendefaults = section_len - line_len;
X    `7D
X
X    /* Document Prolog */
X
X    while (isblank(line) &&
X`09   readline(line, sizeof line, file, &position, &line_len)) `7B
X    `7D
X
X    if (!iscomment(line, "%%BeginSetup") && !iscomment(line, "%%Page:") &&
X`09!iscomment(line, "%%Trailer") && !iscomment(line, "%%EOF")) `7B
X`09doc->beginprolog = position;
X`09section_len = line_len;
X`09preread = 1;
X
X`09while ((preread `7C`7C
X`09`09readline(line, sizeof line, file, &position, &line_len)) &&
X`09       !iscomment(line, "%%EndProlog") &&
X`09       !iscomment(line, "%%BeginSetup") &&
X`09       !iscomment(line, "%%Page:") && !iscomment(line, "%%Trailer") &&
X`09       !iscomment(line, "%%EOF")) `7B
X`09    if (!preread) section_len += line_len;
X`09    preread = 0;
X`09`7D
X`09section_len += line_len;
X`09if (iscomment(line, "%%EndProlog")) `7B
X`09    readline(line, sizeof line, file, &position, &line_len);
X`09    section_len += line_len;
X`09`7D
X`09doc->endprolog = position;
X`09doc->lenprolog = section_len - line_len;
X    `7D
X
X    /* Document Setup,  Page Defaults found here for Version 2 files */
X
X    while (isblank(line) &&
X`09   readline(line, sizeof line, file, &position, &line_len)) `7B
X    `7D
X
X    if (!iscomment(line, "%%Page:") && !iscomment(line, "%%Trailer") &&
X`09!iscomment(line, "%%EOF")) `7B
X`09doc->beginsetup = position;
X`09section_len = line_len;
X`09preread = 1;
X`09while ((preread `7C`7C
X`09`09readline(line, sizeof line, file, &position, &line_len)) &&
X`09       !iscomment(line, "%%EndSetup") && !iscomment(line, "%%Page:") &&
X`09       !iscomment(line, "%%Trailer") && !iscomment(line, "%%EOF")) `7B
X`09    if (!preread) section_len += line_len;
X`09    preread = 0;
X`09    if (!iscomment(line, "%%")) `7B
X`09`09/* Do nothing */
X`09    `7D else if (doc->default_page_orientation == NONE &&
X`09`09iscomment(line+2, "PageOrientation:")) `7B
X`09`09sscanf(line+length("%%PageOrientation:"), "%s", text);
X`09`09if (strcmp(text, "Portrait") == 0) `7B
X`09`09    doc->default_page_orientation = PORTRAIT;
X`09`09`7D else if (strcmp(text, "Landscape") == 0) `7B
X`09`09    doc->default_page_orientation = LANDSCAPE;
X`09`09`7D
X`09    `7D else if (page_media_set == NONE &&
X`09`09       iscomment(line+2, "PaperSize:")) `7B
X`09`09cp = gettext(line+length("%%PaperSize:"), NULL);
X`09`09for (dmp = doc->media, i=0; i<doc->nummedia; i++, dmp++) `7B
X`09`09    /* Note: Paper size comment uses down cased paper size
X`09`09     * name.  Case insensitive compares are only used for
X`09`09     * PaperSize comments.
X`09`09     */
X`09`09    if (strcasecmp(cp, dmp->name) == 0) `7B
X`09`09`09doc->default_page_media = dmp;
X`09`09`09page_media_set = 1;
X`09`09`09break;
X`09`09    `7D
X`09`09`7D
X`09`09free(cp);
X`09    `7D else if (page_bb_set == NONE &&
X`09`09       iscomment(line+2, "PageBoundingBox:")) `7B
X`09`09if (sscanf(line+length("%%PageBoundingBox:"), "%d %d %d %d",
X`09`09`09   &(doc->default_page_boundingbox`5BLLX`5D),
X`09`09`09   &(doc->default_page_boundingbox`5BLLY`5D),
X`09`09`09   &(doc->default_page_boundingbox`5BURX`5D),
X`09`09`09   &(doc->default_page_boundingbox`5BURY`5D)) == 4)
X`09`09    page_bb_set = 1;
X`09`09else `7B
X`09`09    float fllx, flly, furx, fury;
X`09`09    if (sscanf(line+length("%%PageBoundingBox:"), "%f %f %f %f",
X`09`09`09       &fllx, &flly, &furx, &fury) == 4) `7B
X`09`09`09page_bb_set = 1;
X`09`09`09doc->default_page_boundingbox`5BLLX`5D = fllx;
X`09`09`09doc->default_page_boundingbox`5BLLY`5D = flly;
X`09`09`09doc->default_page_boundingbox`5BURX`5D = furx;
X`09`09`09doc->default_page_boundingbox`5BURY`5D = fury;
X`09`09`09if (fllx < doc->default_page_boundingbox`5BLLX`5D)
X`09`09`09    doc->default_page_boundingbox`5BLLX`5D--;
X`09`09`09if (flly < doc->default_page_boundingbox`5BLLY`5D)
X`09`09`09    doc->default_page_boundingbox`5BLLY`5D--;
X`09`09`09if (furx > doc->default_page_boundingbox`5BURX`5D)
X`09`09`09    doc->default_page_boundingbox`5BURX`5D++;
X`09`09`09if (fury > doc->default_page_boundingbox`5BURY`5D)
X`09`09`09    doc->default_page_boundingbox`5BURY`5D++;
X`09`09    `7D
X`09`09`7D
X`09    `7D
X`09`7D
X`09section_len += line_len;
X`09if (iscomment(line, "%%EndSetup")) `7B
X`09    readline(line, sizeof line, file, &position, &line_len);
X`09    section_len += line_len;
X`09`7D
X`09doc->endsetup = position;
X`09doc->lensetup = section_len - line_len;
X    `7D
X
X    /* Individual Pages */
X
X    while (isblank(line) &&
X`09   readline(line, sizeof line, file, &position, &line_len)) `7B
X    `7D
X
Xnewpage:
X    while (iscomment(line, "%%Page:")) `7B
X`09if (maxpages == 0) `7B
X`09    maxpages = 1;
X`09    doc->pages = (struct page *) calloc(maxpages, sizeof(struct page));
X`09    if (doc->pages == NULL) `7B
X`09`09fprintf(stderr,
X`09`09`09"Fatal Error: Dynamic memory exhausted.\n");
X`09`09exit(-1);
X`09    `7D
X`09`7D
X`09label = gettext(line+length("%%Page:"), &next_char);
X`09if (sscanf(next_char, "%d", &thispage) != 1) thispage = 0;
X`09if (nextpage == 1) `7B
X`09    ignore = thispage != 1;
X`09`7D
X`09if (!ignore && thispage != nextpage) `7B
X`09    free(label);
X`09    doc->numpages--;
X`09    goto continuepage;
X`09`7D
X`09nextpage++;
X`09if (doc->numpages == maxpages) `7B
X`09    maxpages++;
X`09    doc->pages = (struct page *)
X`09`09`09 realloc(doc->pages, maxpages*sizeof (struct page));
X`09    if (doc->pages == NULL) `7B
X`09`09fprintf(stderr, "Fatal Error: Dynamic memory exhausted.\n");
X`09`09exit(-1);
X`09    `7D
X`09`7D
X`09memset(&(doc->pages`5Bdoc->numpages`5D), 0, sizeof(struct page));
X`09page_bb_set = NONE;
X`09doc->pages`5Bdoc->numpages`5D.label = label;
X`09doc->pages`5Bdoc->numpages`5D.begin = position;
X`09section_len = line_len;
Xcontinuepage:
X`09while (readline(line, sizeof line, file, &position, &line_len) &&
X`09       !iscomment(line, "%%Page:") && !iscomment(line, "%%Trailer") &&
X`09       !iscomment(line, "%%EOF")) `7B
X`09    section_len += line_len;
X`09    if (!iscomment(line, "%%")) `7B
X`09`09/* Do nothing */
X`09    `7D else if (doc->pages`5Bdoc->numpages`5D.orientation == NONE &&
X`09`09iscomment(line+2, "PageOrientation:")) `7B
X`09`09sscanf(line+length("%%PageOrientation:"), "%s", text);
X`09`09if (strcmp(text, "Portrait") == 0) `7B
X`09`09    doc->pages`5Bdoc->numpages`5D.orientation = PORTRAIT;
X`09`09`7D else if (strcmp(text, "Landscape") == 0) `7B
X`09`09    doc->pages`5Bdoc->numpages`5D.orientation = LANDSCAPE;
X`09`09`7D
X`09    `7D else if (doc->pages`5Bdoc->numpages`5D.media == NULL &&
X`09`09       iscomment(line+2, "PageMedia:")) `7B
X`09`09cp = gettext(line+length("%%PageMedia:"), NULL);
X`09`09for (dmp = doc->media, i=0; i<doc->nummedia; i++, dmp++) `7B
X`09`09    if (strcmp(cp, dmp->name) == 0) `7B
X`09`09`09doc->pages`5Bdoc->numpages`5D.media = dmp;
X`09`09`09break;
X`09`09    `7D
X`09`09`7D
X`09`09free(cp);
X`09    `7D else if (doc->pages`5Bdoc->numpages`5D.media == NULL &&
X`09`09       iscomment(line+2, "PaperSize:")) `7B
X`09`09cp = gettext(line+length("%%PaperSize:"), NULL);
X`09`09for (dmp = doc->media, i=0; i<doc->nummedia; i++, dmp++) `7B
X`09`09    /* Note: Paper size comment uses down cased paper size
X`09`09     * name.  Case insensitive compares are only used for
X`09`09     * PaperSize comments.
X`09`09     */
X`09`09    if (strcasecmp(cp, dmp->name) == 0) `7B
X`09`09`09doc->pages`5Bdoc->numpages`5D.media = dmp;
X`09`09`09break;
X`09`09    `7D
X`09`09`7D
X`09`09free(cp);
X`09    `7D else if ((page_bb_set == NONE `7C`7C page_bb_set == ATEND) &&
X`09`09       iscomment(line+2, "PageBoundingBox:")) `7B
X`09`09sscanf(line+length("%%PageBoundingBox:"), "%s", text);
X`09`09if (strcmp(text, "(atend)") == 0) `7B
X`09`09    page_bb_set = ATEND;
X`09`09`7D else `7B
X`09`09    if (sscanf(line+length("%%PageBoundingBox:"), "%d %d %d %d",
X`09`09`09    &(doc->pages`5Bdoc->numpages`5D.boundingbox`5BLLX`5D),
X`09`09`09    &(doc->pages`5Bdoc->numpages`5D.boundingbox`5BLLY`5D),
X`09`09`09    &(doc->pages`5Bdoc->numpages`5D.boundingbox`5BURX`5D),
X`09`09`09    &(doc->pages`5Bdoc->numpages`5D.boundingbox`5BURY`5D)) == 4)
X`09`09`09if (page_bb_set == NONE) page_bb_set = 1;
X`09`09    else `7B
X`09`09`09float fllx, flly, furx, fury;
X`09`09`09if (sscanf(line+length("%%PageBoundingBox:"),
X`09`09`09`09   "%f %f %f %f",
X`09`09`09`09   &fllx, &flly, &furx, &fury) == 4) `7B
X`09`09`09    if (page_bb_set == NONE) page_bb_set = 1;
X`09`09`09    doc->pages`5Bdoc->numpages`5D.boundingbox`5BLLX`5D = fllx;
X`09`09`09    doc->pages`5Bdoc->numpages`5D.boundingbox`5BLLY`5D = flly;
X`09`09`09    doc->pages`5Bdoc->numpages`5D.boundingbox`5BURX`5D = furx;
X`09`09`09    doc->pages`5Bdoc->numpages`5D.boundingbox`5BURY`5D = fury;
X`09`09`09    if (fllx <
X`09`09`09`09    doc->pages`5Bdoc->numpages`5D.boundingbox`5BLLX`5D)
X`09`09`09`09doc->pages`5Bdoc->numpages`5D.boundingbox`5BLLX`5D--;
X`09`09`09    if (flly <
X`09`09`09`09    doc->pages`5Bdoc->numpages`5D.boundingbox`5BLLY`5D)
X`09`09`09`09doc->pages`5Bdoc->numpages`5D.boundingbox`5BLLY`5D--;
X`09`09`09    if (furx >
X`09`09`09`09    doc->pages`5Bdoc->numpages`5D.boundingbox`5BURX`5D)
X`09`09`09`09doc->pages`5Bdoc->numpages`5D.boundingbox`5BURX`5D++;
X`09`09`09    if (fury >
X`09`09`09`09    doc->pages`5Bdoc->numpages`5D.boundingbox`5BURY`5D)
X`09`09`09`09doc->pages`5Bdoc->numpages`5D.boundingbox`5BURY`5D++;
X`09`09`09`7D
X`09`09    `7D
X`09`09`7D
X`09    `7D
X`09`7D
X`09section_len += line_len;
X`09doc->pages`5Bdoc->numpages`5D.end = position;
X`09doc->pages`5Bdoc->numpages`5D.len = section_len - line_len;
X`09doc->numpages++;
X    `7D
X
X    /* Document Trailer */
X
X    doc->begintrailer = position;
X    section_len = line_len;
X
X    preread = 1;
X    while ((preread `7C`7C
X`09    readline(line, sizeof line, file, &position, &line_len)) &&
X`09   !iscomment(line, "%%EOF")) `7B
X`09if (!preread) section_len += line_len;
X`09preread = 0;
X`09if (!iscomment(line, "%%")) `7B
X`09    /* Do nothing */
X`09`7D else if (iscomment(line+2, "Page:")) `7B
X`09    free(gettext(line+length("%%Page:"), &next_char));
X`09    if (sscanf(next_char, "%d", &thispage) != 1) thispage = 0;
X`09    if (!ignore && thispage == nextpage) `7B
X`09`09doc->pages`5Bdoc->numpages-1`5D.end = position;
X`09`09doc->pages`5Bdoc->numpages-1`5D.len += section_len - line_len;
X`09`09goto newpage;
X`09    `7D
X`09`7D else if (bb_set == ATEND && iscomment(line+2, "BoundingBox:")) `7B
X`09    if (sscanf(line+length("%%BoundingBox:"), "%d %d %d %d",
X`09`09       &(doc->boundingbox`5BLLX`5D),
X`09`09       &(doc->boundingbox`5BLLY`5D),
X`09`09       &(doc->boundingbox`5BURX`5D),
X`09`09       &(doc->boundingbox`5BURY`5D)) != 4) `7B
X`09`09float fllx, flly, furx, fury;
X`09`09if (sscanf(line+length("%%BoundingBox:"), "%f %f %f %f",
X`09`09`09   &fllx, &flly, &furx, &fury) == 4) `7B
X`09`09    doc->boundingbox`5BLLX`5D = fllx;
X`09`09    doc->boundingbox`5BLLY`5D = flly;
X`09`09    doc->boundingbox`5BURX`5D = furx;
X`09`09    doc->boundingbox`5BURY`5D = fury;
X`09`09    if (fllx < doc->boundingbox`5BLLX`5D)
X`09`09`09doc->boundingbox`5BLLX`5D--;
X`09`09    if (flly < doc->boundingbox`5BLLY`5D)
X`09`09`09doc->boundingbox`5BLLY`5D--;
X`09`09    if (furx > doc->boundingbox`5BURX`5D)
X`09`09`09doc->boundingbox`5BURX`5D++;
X`09`09    if (fury > doc->boundingbox`5BURY`5D)
X`09`09`09doc->boundingbox`5BURY`5D++;
X`09`09`7D
X`09    `7D
X`09`7D else if (orientation_set == ATEND &&
X`09`09   iscomment(line+2, "Orientation:")) `7B
X`09    sscanf(line+length("%%Orientation:"), "%s", text);
X`09    if (strcmp(text, "Portrait") == 0) `7B
X`09`09doc->orientation = PORTRAIT;
X`09    `7D else if (strcmp(text, "Landscape") == 0) `7B
X`09`09doc->orientation = LANDSCAPE;
X`09    `7D
X`09`7D else if (page_order_set == ATEND && iscomment(line+2, "PageOrder:"))
V `7B
X`09    sscanf(line+length("%%PageOrder:"), "%s", text);
X`09    if (strcmp(text, "Ascend") == 0) `7B
X`09`09doc->pageorder = ASCEND;
X`09    `7D else if (strcmp(text, "Descend") == 0) `7B
X`09`09doc->pageorder = DESCEND;
X`09    `7D else if (strcmp(text, "Special") == 0) `7B
X`09`09doc->pageorder = SPECIAL;
X`09    `7D
X`09`7D else if (pages_set == ATEND && iscomment(line+2, "Pages:")) `7B
X`09    if (sscanf(line+length("%%Pages:"), "%*u %d", &i) == 1) `7B
X`09`09if (page_order_set == NONE) `7B
X`09`09    if (i == -1) doc->pageorder = DESCEND;
X`09`09    else if (i == 0) doc->pageorder = SPECIAL;
X`09`09    else if (i == 1) doc->pageorder = ASCEND;
X`09`09`7D
X`09    `7D
X`09`7D
X    `7D
X    section_len += line_len;
X    if (iscomment(line, "%%EOF")) `7B
X`09readline(line, sizeof line, file, &position, &line_len);
X`09section_len += line_len;
X    `7D
X    doc->endtrailer = position;
X    doc->lentrailer = section_len - line_len;
X
X    section_len = line_len;
X    preread = 1;
X    while (preread `7C`7C
X`09   readline(line, sizeof line, file, &position, &line_len)) `7B
X`09if (!preread) section_len += line_len;
X`09preread = 0;
X`09if (iscomment(line, "%%Page:")) `7B
X`09    free(gettext(line+length("%%Page:"), &next_char));
X`09    if (sscanf(next_char, "%d", &thispage) != 1) thispage = 0;
X`09    if (!ignore && thispage == nextpage) `7B
X`09`09doc->pages`5Bdoc->numpages-1`5D.end = position;
X`09`09doc->pages`5Bdoc->numpages-1`5D.len += doc->lentrailer +
X`09`09`09`09`09`09   section_len - line_len;
X`09`09goto newpage;
X`09    `7D
X`09`7D
X    `7D
X    return doc;
X`7D
X
X/*
X *`09psfree -- free dynamic storage associated with document structure.
X */
X
Xvoid
Xpsfree(doc)
X    struct document *doc;
X`7B
X    int i;
X
X    if (doc) `7B
X`09for (i=0; i<doc->numpages; i++) `7B
X`09    if (doc->pages`5Bi`5D.label) free(doc->pages`5Bi`5D.label);
X`09`7D
X`09for (i=0; i<doc->nummedia; i++) `7B
X`09    if (doc->media`5Bi`5D.name) free(doc->media`5Bi`5D.name);
X`09`7D
X`09if (doc->title) free(doc->title);
X`09if (doc->date) free(doc->date);
X`09if (doc->pages) free(doc->pages);
X`09if (doc->media) free(doc->media);
X`09free(doc);
X    `7D
X`7D
X
X/*
X * gettextine -- skip over white space and return the rest of the line.
X *               If the text begins with '(' return the text string
X *`09`09 using gettext().
X */
X
Xstatic char *
Xgettextline(line)
X    char *line;
X`7B
X    char *cp;
X
X    while (*line && (*line == ' ' `7C`7C *line == '\t')) line++;
X    if (*line == '(') `7B
X`09return gettext(line, NULL);
X    `7D else `7B
X`09if (strlen(line) == 0) return NULL;
X`09cp = (char *) malloc(strlen(line));
X`09if (cp == NULL) `7B
X`09    fprintf(stderr, "Fatal Error: Dynamic memory exhausted.\n");
X`09    exit(-1);
X`09`7D
X`09strncpy(cp, line, strlen(line)-1);
X`09cp`5Bstrlen(line)-1`5D = '\0';
X`09return cp;
X    `7D
X`7D
X
X/*
X *`09gettext -- return the next text string on the line.
X *`09`09   return NULL if nothing is present.
X */
X
Xstatic char *
Xgettext(line, next_char)
X    char *line;
X    char **next_char;
X`7B
X    char text`5BPSLINELENGTH`5D;`09/* Temporary storage for text */
X    char *cp;
X    int quoted=0;
X
X    while (*line && (*line == ' ' `7C`7C *line == '\t')) line++;
X    cp = text;
X    if (*line == '(') `7B
X`09int level = 0;
X`09quoted=1;
X`09line++;
X`09while (*line && !(*line == ')' && level == 0 )) `7B
X`09    if (*line == '\\') `7B
X`09`09if (*(line+1) == 'n') `7B
X`09`09    *cp++ = '\n';
X`09`09    line += 2;
X`09`09`7D else if (*(line+1) == 'r') `7B
X`09`09    *cp++ = '\r';
X`09`09    line += 2;
X`09`09`7D else if (*(line+1) == 't') `7B
X`09`09    *cp++ = '\t';
X`09`09    line += 2;
X`09`09`7D else if (*(line+1) == 'b') `7B
X`09`09    *cp++ = '\b';
X`09`09    line += 2;
X`09`09`7D else if (*(line+1) == 'f') `7B
X`09`09    *cp++ = '\f';
X`09`09    line += 2;
X`09`09`7D else if (*(line+1) == '\\') `7B
X`09`09    *cp++ = '\\';
X`09`09    line += 2;
X`09`09`7D else if (*(line+1) == '(') `7B
X`09`09    *cp++ = '(';
X`09`09    line += 2;
X`09`09`7D else if (*(line+1) == ')') `7B
X`09`09    *cp++ = ')';
X`09`09    line += 2;
X`09`09`7D else if (*(line+1) >= '0' && *(line+1) <= '9') `7B
X`09`09    if (*(line+2) >= '0' && *(line+2) <= '9') `7B
X`09`09`09if (*(line+3) >= '0' && *(line+3) <= '9') `7B
X`09`09`09    *cp++ = ((*(line+1) - '0')*8 + *(line+2) - '0')*8 +
X`09`09`09`09    *(line+3) - '0';
X`09`09`09    line += 4;
X`09`09`09`7D else `7B
X`09`09`09    *cp++ = (*(line+1) - '0')*8 + *(line+2) - '0';
X`09`09`09    line += 3;
X`09`09`09`7D
X`09`09    `7D else `7B
X`09`09`09*cp++ = *(line+1) - '0';
X`09`09`09line += 2;
X`09`09    `7D
X`09`09`7D else `7B
X`09`09    line++;
X`09`09    *cp++ = *line++;
X`09`09`7D
X`09    `7D else if (*line == '(') `7B
X`09`09level++;
X`09`09*cp++ = *line++;
X`09    `7D else if (*line == ')') `7B
X`09`09level--;
X`09`09*cp++ = *line++;
X`09    `7D else `7B
X`09`09*cp++ = *line++;
X`09    `7D
X`09`7D
X    `7D else `7B
X`09while (*line && !(*line == ' ' `7C`7C *line == '\t' `7C`7C *line == '\n')
V)
X`09    *cp++ = *line++;
X    `7D
X    *cp = '\0';
X    if (next_char) *next_char = line;
X    if (!quoted && strlen(text) == 0) return NULL;
X    cp = (char *) malloc(strlen(text)+1);
X    if (cp == NULL) `7B
X`09fprintf(stderr, "Fatal Error: Dynamic memory exhausted.\n");
X`09exit(-1);
X    `7D
X    strcpy(cp, text);
X    return cp;
X`7D
X
X/*
X *`09readline -- Read the next line in the postscript file.
X *                  Automatically skip over data (as indicated by
X *                  %%BeginBinary/%%EndBinary or %%BeginData/%%EndData
X *`09`09    comments.)
X *`09`09    Also, skip over included documents (as indicated by
X *`09`09    %%BeginDocument/%%EndDocument comments.)
X */
X
Xstatic char *
Xreadline(line, size, fp, position, line_len)
X    char *line;
X    int size;
X    FILE *fp;
X    long *position;
X    unsigned int *line_len;
X`7B
X    char text`5BPSLINELENGTH`5D;`09/* Temporary storage for text */
X    char save`5BPSLINELENGTH`5D;`09/* Temporary storage for text */
X    char *cp;
X    unsigned int num;
X    unsigned int nbytes;
X    int i;
X    char buf`5BBUFSIZ`5D;
X
X    if (position) *position = ftell(fp);
X    cp = fgets(line, size, fp);
X    *line_len = cp ? strlen(line) : 0;
X    if (iscomment(line, "%%BeginDocument:")) `7B
X`09strcpy(save, line+7);
X`09while (readline(line, size, fp, NULL, &nbytes) &&
X`09       !iscomment(line, "%%EndDocument")) `7B
X`09    *line_len += nbytes;
X`09`7D
X`09*line_len += nbytes;
X`09strcpy(line+2, save);
X    `7D else if (iscomment(line, "%%BeginFeature:")) `7B
X`09strcpy(save, line+7);
X`09while (readline(line, size, fp, NULL, &nbytes) &&
X`09       !iscomment(line, "%%EndFeature")) `7B
X`09    *line_len += nbytes;
X`09`7D
X`09*line_len += nbytes;
X`09strcpy(line+2, save);
X    `7D else if (iscomment(line, "%%BeginFile:")) `7B
X`09strcpy(save, line+7);
X`09while (readline(line, size, fp, NULL, &nbytes) &&
X`09       !iscomment(line, "%%EndFile")) `7B
X`09    *line_len += nbytes;
X`09`7D
X`09*line_len += nbytes;
X`09strcpy(line+2, save);
X    `7D else if (iscomment(line, "%%BeginFont:")) `7B
X`09strcpy(save, line+7);
X`09while (readline(line, size, fp, NULL, &nbytes) &&
X`09       !iscomment(line, "%%EndFont")) `7B
X`09    *line_len += nbytes;
X`09`7D
X`09*line_len += nbytes;
X`09strcpy(line+2, save);
X    `7D else if (iscomment(line, "%%BeginProcSet:")) `7B
X`09strcpy(save, line+7);
X`09while (readline(line, size, fp, NULL, &nbytes) &&
X`09       !iscomment(line, "%%EndProcSet")) `7B
X`09    *line_len += nbytes;
X`09`7D
X`09*line_len += nbytes;
X`09strcpy(line+2, save);
X    `7D else if (iscomment(line, "%%BeginResource:")) `7B
X`09strcpy(save, line+7);
X`09while (readline(line, size, fp, NULL, &nbytes) &&
X`09       !iscomment(line, "%%EndResource")) `7B
X`09    *line_len += nbytes;
X`09`7D
X`09*line_len += nbytes;
X`09strcpy(line+2, save);
X    `7D else if (iscomment(line, "%%BeginData:")) `7B
X`09text`5B0`5D = '\0';
X`09strcpy(save, line+7);
X`09if (sscanf(line+length("%%BeginData:"), "%d %*s %s", &num, text) >= 1) `7
VB
X`09    if (strcmp(text, "Lines") == 0) `7B
X`09`09for (i=0; i < num; i++) `7B
X`09`09    cp = fgets(line, size, fp);
X`09`09    *line_len += cp ? strlen(line) : 0;
X`09`09`7D
X`09    `7D else `7B
X`09`09while (num > BUFSIZ) `7B
X`09`09    fread(buf, sizeof (char), BUFSIZ, fp);
X`09`09    *line_len += BUFSIZ;
X`09`09    num -= BUFSIZ;
X`09`09`7D
X`09`09fread(buf, sizeof (char), num, fp);
X`09`09*line_len += num;
X`09    `7D
X`09`7D
X`09while (readline(line, size, fp, NULL, &nbytes) &&
X`09       !iscomment(line, "%%EndData")) `7B
X`09    *line_len += nbytes;
X`09`7D
X`09*line_len += nbytes;
X`09strcpy(line+2, save);
X    `7D else if (iscomment(line, "%%BeginBinary:")) `7B
X`09strcpy(save, line+7);
X`09if(sscanf(line+length("%%BeginBinary:"), "%d", &num) == 1) `7B
X`09    while (num > BUFSIZ) `7B
X`09`09fread(buf, sizeof (char), BUFSIZ, fp);
X`09`09*line_len += BUFSIZ;
X`09`09num -= BUFSIZ;
X`09    `7D
X`09    fread(buf, sizeof (char), num, fp);
X`09    *line_len += num;
X`09`7D
X`09while (readline(line, size, fp, NULL, &nbytes) &&
X`09       !iscomment(line, "%%EndBinary")) `7B
X`09    *line_len += nbytes;
X`09`7D
X`09*line_len += nbytes;
X`09strcpy(line+2, save);
X    `7D
X    return cp;
X`7D
X
X/*
X *`09pscopy -- copy lines of Postscript from a section of one file
X *`09`09  to another file.
X *                Automatically switch to binary copying whenever
X *                %%BeginBinary/%%EndBinary or %%BeginData/%%EndData
X *`09`09  comments are encountered.
X */
X
Xvoid
Xpscopy(from, to, begin, end)
X    FILE *from;
X    FILE *to;
X    long begin;`09`09`09/* set negative to avoid initial seek */
X    long end;
X`7B
X    char line`5BPSLINELENGTH`5D;`09/* 255 characters + 1 newline + 1 NULL */
X    char text`5BPSLINELENGTH`5D;`09/* Temporary storage for text */
X    unsigned int num;
X    int i;
X    char buf`5BBUFSIZ`5D;
X
X    if (begin >= 0) fseek(from, begin, SEEK_SET);
X    while (ftell(from) < end) `7B
X
X`09fgets(line, sizeof line, from);
X`09fputs(line, to);
X
X`09if (iscomment(line, "%%BeginData:")) `7B
X`09    text`5B0`5D = '\0';
X`09    if (sscanf(line+length("%%BeginData:"),
X`09`09       "%d %*s %s", &num, text) >= 1) `7B
X`09`09if (strcmp(text, "Lines") == 0) `7B
X`09`09    for (i=0; i < num; i++) `7B
X`09`09`09fgets(line, sizeof line, from);
X`09`09`09fputs(line, to);
X`09`09    `7D
X`09`09`7D else `7B
X`09`09    while (num > BUFSIZ) `7B
X`09`09`09fread(buf, sizeof (char), BUFSIZ, from);
X`09`09`09fwrite(buf, sizeof (char), BUFSIZ, to);
X`09`09`09num -= BUFSIZ;
X`09`09    `7D
X`09`09    fread(buf, sizeof (char), num, from);
X`09`09    fwrite(buf, sizeof (char), num, to);
X`09`09`7D
X`09    `7D
X`09`7D else if (iscomment(line, "%%BeginBinary:")) `7B
X`09    if(sscanf(line+length("%%BeginBinary:"), "%d", &num) == 1) `7B
X`09`09while (num > BUFSIZ) `7B
X`09`09    fread(buf, sizeof (char), BUFSIZ, from);
X`09`09    fwrite(buf, sizeof (char), BUFSIZ, to);
X`09`09    num -= BUFSIZ;
X`09`09`7D
X`09`09fread(buf, sizeof (char), num, from);
X`09`09fwrite(buf, sizeof (char), num, to);
X`09    `7D
X`09`7D
X    `7D
X`7D
X
X/*
X *`09pscopyuntil -- copy lines of Postscript from a section of one file
X *`09`09       to another file until a particular comment is reached.
X *                     Automatically switch to binary copying whenever
X *                     %%BeginBinary/%%EndBinary or %%BeginData/%%EndData
X *`09`09       comments are encountered.
X */
X
Xchar *
Xpscopyuntil(from, to, begin, end, comment)
X    FILE *from;
X    FILE *to;
X    long begin;`09`09`09/* set negative to avoid initial seek */
X    long end;
X#if NeedFunctionPrototypes
X    const
X#endif
X    char *comment;
X`7B
X    char line`5BPSLINELENGTH`5D;`09/* 255 characters + 1 newline + 1 NULL */
X    char text`5BPSLINELENGTH`5D;`09/* Temporary storage for text */
X    unsigned int num;
X    int comment_length;
X    int i;
X    char buf`5BBUFSIZ`5D;
X    char *cp;
X
X    comment_length = strlen(comment);
X    if (begin >= 0) fseek(from, begin, SEEK_SET);
X    while (ftell(from) < end) `7B
X
X`09fgets(line, sizeof line, from);
X
X`09/* iscomment cannot be used here,
X`09 * because comment_length is not known at compile time. */
X`09if (strncmp(line, comment, comment_length) == 0) `7B
X`09    cp = (char *) malloc(strlen(line)+1);
X`09    if (cp == NULL) `7B
X`09`09fprintf(stderr, "Fatal Error: Dynamic memory exhausted.\n");
X`09`09exit(-1);
X`09    `7D
X`09    strcpy(cp, line);
X`09    return cp;
X`09`7D
X`09fputs(line, to);
X`09if (iscomment(line, "%%BeginData:")) `7B
X`09    text`5B0`5D = '\0';
X`09    if (sscanf(line+length("%%BeginData:"),
X`09`09       "%d %*s %s", &num, text) >= 1) `7B
X`09`09if (strcmp(text, "Lines") == 0) `7B
X`09`09    for (i=0; i < num; i++) `7B
X`09`09`09fgets(line, sizeof line, from);
X`09`09`09fputs(line, to);
X`09`09    `7D
X`09`09`7D else `7B
X`09`09    while (num > BUFSIZ) `7B
X`09`09`09fread(buf, sizeof (char), BUFSIZ, from);
X`09`09`09fwrite(buf, sizeof (char), BUFSIZ, to);
X`09`09`09num -= BUFSIZ;
X`09`09    `7D
X`09`09    fread(buf, sizeof (char), num, from);
X`09`09    fwrite(buf, sizeof (char), num, to);
X`09`09`7D
X`09    `7D
X`09`7D else if (iscomment(line, "%%BeginBinary:")) `7B
X`09    if(sscanf(line+length("%%BeginBinary:"), "%d", &num) == 1) `7B
X`09`09while (num > BUFSIZ) `7B
X`09`09    fread(buf, sizeof (char), BUFSIZ, from);
X`09`09    fwrite(buf, sizeof (char), BUFSIZ, to);
X`09`09    num -= BUFSIZ;
X`09`09`7D
X`09`09fread(buf, sizeof (char), num, from);
X`09`09fwrite(buf, sizeof (char), num, to);
X`09    `7D
X`09`7D
X    `7D
X    return NULL;
X`7D
X
X/*
X *`09isblank -- determine whether the line contains nothing but whitespace.
X */
X
Xstatic int
Xisblank(line)
X    char *line;
X`7B
X    while (*line == ' ' `7C`7C *line == '\t') line++;
X    return *line == '\n';
X`7D
$ CALL UNPACK PS.C;1 292598108
$ create 'f'
X/*
X * ps.h -- Include file for PostScript routines.
X * Copyright (C) 1992  Timothy O. Theisen
X *
X * This program is free software; you can redistribute it and/or modify
X * it under the terms of the GNU General Public License as published by
X * the Free Software Foundation; either version 2 of the License, or
X * (at your option) any later version.
X *
X * This program is distributed in the hope that it will be useful,
X * but WITHOUT ANY WARRANTY; without even the implied warranty of
X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X * GNU General Public License for more details.
X *
X * You should have received a copy of the GNU General Public License
X * along with this program; if not, write to the Free Software
X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X *
X *   Author: Tim Theisen           Systems Programmer
X * Internet: tim@cs.wisc.edu       Department of Computer Sciences
X *     UUCP: uwvax!tim             University of Wisconsin-Madison
X *    Phone: (608)262-0438         1210 West Dayton Street
X *      FAX: (608)262-9777         Madison, WI   53706
X */
X
X#ifndef NeedFunctionPrototypes
X#if defined(FUNCPROTO) `7C`7C defined(__STDC__) `7C`7C defined(__cplusplus)
V `7C`7C defined(c_plusplus)
X#define NeedFunctionPrototypes 1
X#else
X#define NeedFunctionPrototypes 0
X#endif /* __STDC__ */
X#endif /* NeedFunctionPrototypes */
X
X`09/* Constants used to index into the bounding box array. */
X
X#define LLX 0
X#define LLY 1
X#define URX 2
X#define URY 3
X
X`09/* Constants used to store keywords that are scanned. */
X`09/* NONE is not a keyword, it tells when a field was not set */
X
Xenum `7BATEND = -1, NONE = 0, PORTRAIT, LANDSCAPE, ASCEND, DESCEND, SPECIAL`
V7D;
X
X#define PSLINELENGTH 257`09/* 255 characters + 1 newline + 1 NULL */
X
Xstruct document `7B
X    int  epsf;`09`09`09`09/* Encapsulated PostScript flag. */
X    char *title;`09`09`09/* Title of document. */
X    char *date;`09`09`09`09/* Creation date. */
X    int  pageorder;`09`09`09/* ASCEND, DESCEND, SPECIAL */
X    long beginheader, endheader;`09/* offsets into file */
X    unsigned int lenheader;
X    long beginpreview, endpreview;
X    unsigned int lenpreview;
X    long begindefaults, enddefaults;
X    unsigned int lendefaults;
X    long beginprolog, endprolog;
X    unsigned int lenprolog;
X    long beginsetup, endsetup;
X    unsigned int lensetup;
X    long begintrailer, endtrailer;
X    unsigned int lentrailer;
X    int  boundingbox`5B4`5D;
X    int  default_page_boundingbox`5B4`5D;
X    int  orientation;`09`09`09/* PORTRAIT, LANDSCAPE */
X    int  default_page_orientation;`09/* PORTRAIT, LANDSCAPE */
X    unsigned int nummedia;
X    struct documentmedia *media;
X    struct documentmedia *default_page_media;
X    unsigned int numpages;
X    struct page *pages;
X`7D;
X
Xstruct page `7B
X    char *label;
X    int  boundingbox`5B4`5D;
X    struct documentmedia *media;
X    int  orientation;`09`09`09/* PORTRAIT, LANDSCAPE */
X    long begin, end;`09`09`09/* offsets into file */
X    unsigned int len;
X`7D;
X
Xstruct documentmedia `7B
X    char *name;
X    int width, height;
X`7D;
X
X`09/* list of standard paper sizes from Adobe's PPD. */
X
Xextern struct documentmedia papersizes`5B`5D;
X
X`09/* scans a PostScript file and return a pointer to the document
X`09   structure.  Returns NULL if file does not Conform to commenting
X`09   conventions . */
X
X#if NeedFunctionPrototypes
Xstruct document *psscan(FILE *);
X#else
Xstruct document *psscan();
X#endif
X
X`09/* free data structure malloc'ed by psscan */
X
X#if NeedFunctionPrototypes
Xvoid psfree(struct document *);
X#else
Xvoid psfree();
X#endif
X
X`09/* Copy a portion of the PostScript file */
X
X#if NeedFunctionPrototypes
Xvoid pscopy(FILE *from, FILE *to, long begin, long end);
X#else
Xvoid pscopy();
X#endif
X
X`09/* Copy a portion of the PostScript file upto a comment */
X
X#if NeedFunctionPrototypes
Xchar *pscopyuntil(FILE *from, FILE *to, long begin, long end,
X`09`09  const char *comment);
X#else
Xchar *pscopyuntil();
X#endif
$ CALL UNPACK PS.H;1 142129844
$ create 'f'
X
X    Ghostview -- An X11 user interface for ghostscript.
X
XGhostview is full function user interface for ghostscript 2.4.
X
XBrief list of features:
X  - Ghostview parses any known version of Adobe's Document Structuring
X    Conventions.
X  - Page size is automatically determined from the Document Structuring
X    Comments.  The user is able to override the values from the comments.
X  - Window size is set to the bounding box for Encapsulated PostScript figur
Ves.
X  - Default page size is Letter and can be changed via Xresources or
X    application defaults file to A4 (or any other valid size) for our
X    European friends.
X  - Scrollbars appear when necessary.
X  - Page orientation is automatically determined from the Document Structuri
Vng
X    Comments.  The user is able to override the values from the comments.
X  - Ability to view at 4 orientations: Portrait, Landscape, Upside-down,
X    and Seascape (for those who rotate landscape the other direction).
X  - Ability to preview in any supported visual.  (Can preview in gray-scale`
V20
X    or color on a Color monitor.)
X  - Ability to mark pages for printing, or saving.  (Good for people that
X    printed a 100 page document and lost page 59 due to a printer jam.)
X  - Can popup zoom windows at printer resolution
X    (1 display dot = 1 printer dot).
X
X    The Ghostview distribution includes a Ghostview Widget that people
X    are encouraged to use in other programs.
X
X    Ghostview-1.4 is available via anonymous ftp from:
X`09prep.ai.mit.edu:/pub/gnu/ghostview-1.4.tar.Z
X`09ftp.cs.wisc.edu:/pub/X/ghostview-1.4.tar.Z
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 2 of the License, or
X    (at your option) any later version.
X
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X
XBuilding ghostview:
X
X    If you have xmkmf, type "xmkmf", and then "make".
X    If not, manually edit the Makefile.
X
XFeedback
X
X    I welcome any feedback that you care to give.  Of course, I am intereste
Vd
X    in your success stories.  I will also try to help you if you have proble
Vms.
X    However, I cannot make any promise of support.
X
X    Please send all feedback to ghostview@cs.wisc.edu.  This is a spare time
X    project and all the mail regarding ghostview must be directed to a
X    separate mail box otherwise your mail may very well get lost in the crac
Vks.
X
XFrequently asked questions:
X
X    1.  Why does half the functionality of ghostview seem to be missing?
X`09I cannot skip around in the document.  I cannot select pages to
X`09print.  There are no page numbers in the table of contents.
X
X`09The problem is that the document does not have the document
X`09structuring comments.  Without them, ghostview cannot tell where
X`09pages start and end.  Also, when reading from stdin there is no
X`09capability to skip around.
X
X    2.  Whenever I ask ghostview to display a page, a separate ghostscript
X`09window pops up and disappears when ghostscript is done rendering
X`09the page.  How to I get ghostscript to write on the ghostview window?
X
X`09You must be running ghostscript 2.4 or later for ghostview to work
X`09properly.  You can pick up the current copy of ghostscript from
X`09the same place you got ghostview.
X
X    3.  When I start ghostview, the information window pops up with:
X`09"Warning: Could not allocate backing pixmap in main window."
X`09What does this mean?
X
X`09Ghostscript draws into a backing pixmap and copies from the
X`09pixmap to the window.  Some X servers have limited resources for
X`09pixmaps.  Creating the backing pixmap failed.  Ghostview will then`20
X`09request backing store on the window.  If the backing store request
X`09is not honored, obscured portions of the window will be lost.
X
X`09You might also request a smaller window by setting a smaller
X`09magstep or setting a smaller resolution.
X
X    4.  When I start ghostview, sometimes I get this error:
X`09"Error: SmeBSB Object: Left Bitmap of entry  "0" is not one bit deep.."
X`09Other times it works.  What is going wrong?
X
X`09The only time this problem occurs is when an OpenWindows X server
X`09is the display.  It is likely a server problem.  I have placed a
X`09work around in ghostview that turns off all use of bitmaps.  The
X`09-openwindows option enables this work around.  However, with it
X`09enabled the current magstep, orientation, and media cannot be
X`09marked in the popup menus.
X
X    5.  Sometimes ghostview produces an endless stream of this message:
X`09"Warning: Select failed; error code 9".
X
X`09Users have reported that this occurs on machines with a SYSV
X`09and BSD library.  The problem went away when they linked with the
X`09BSD library rather than the default SYSV library.
X
X`09This also occurs on some SPARCS running SunOS.  This does not happen
X`09for me and must be due to some differences in libraries or environment.
X`09I have placed a SPARC executable (compiled on SunOS 4.1 with X11R5pl10
X`09libraries statically linked in) on ftp.cs.wisc.edu for people
X`09in this situation.
X
X    6.  When using ncdwm, sometimes the window shrinks to an extremely
X`09small size.
X
X`09Either use the -ncdwm option to work around the problem, or apply
X`09fix-10 to X11R5.
X
X    7.  Ghostview pops up the information window with the message
X`09"Exec of gs failed".  It never displays anything in the main
X`09viewport.  What went wrong?
X
X`09Either ghostscript is not installed or it cannot be found in
X`09your PATH.  Please pick up the latest copy of ghostcript from
X`09the same place you got ghostview and install it.
X
XAcknowledgements
X
X    I really should put down the names of all the people who have given
X    me suggestions and encouragement.  (But I don't want to hold up the
X    release any longer. :-)
X
X    I do want to thank a few people.
X
X    - Karl Berry, for getting me into this mess :-) by soliciting for
X      volunteers.
X    - L. Peter Deutsch, for making ghostscript the good interpreter that
X      it is and for working with me to include modifications in support of
X      ghostview.
X    - Erik M. van der Poel, for writing a good publicly available file
X      selection widget that I was able incorporate into ghostview.
X    - Terry Poot, for porting ghostview to VMS.
X
XNOTE: PLEASE send all ghostview related mail to ghostview@cs.wisc.edu.
X
X          Tim Theisen           Systems Programmer
XInternet: tim@cs.wisc.edu       Department of Computer Sciences
X    UUCP: uwvax!tim             University of Wisconsin-Madison
X   Phone: (608)262-0438         1210 West Dayton Street
X     FAX: (608)262-9777         Madison, WI   53706
$ CALL UNPACK README.;1 1935059068
$ create 'f'
X
X
X
X                  XsraSelFile File Selection Dialog Package
X
X
X
XThis directory contains the XsraSelFile file selection dialog package. This
Xpackage allows an application to obtain a filename from a user. The filename
V is
Xselected by typing in a text widget or by browsing with the mouse in directo
Vry
Xlistings.
X
XThe following is a brief description of the available features.
X
X* filename completion
X
X    When the user types a filename in the Text widget, SelFile shows the
X    possible completions in the directory listings. The user can hit the spa
Vce
X    bar to complete the filename.
X
X* fast directory reading
X
X    When a directory is opened, the entries are read and sorted. Then the st
Vats
X    of only the first screenful of entries are taken, and these entries are
X    displayed. The stats of the other entries are taken upon demand (i.e. wh
Ven
X    the user wishes to see them by scrolling, etc.) or in the background. Th
Ve
X    Xt work procedure facility is used to do background work. The idea here
V is
X    to give the user some feedback as soon as possible.
X
X    "It's just an illu--sion" :-)
X
X* Xaw and/or Xw widgets
X
X    SelFile can be linked with Xaw (Athena) and/or Xw (Hewlett-Packard)
X    widgets. Normally, SelFile is linked with the R3 or a later version of t
Vhe
X    Xt Intrinsics, but it can be linked with the R2 Xt. See the Imakefile fo
Vr
X    details.
X
X* automatic display update after directory modification
X
X    Every now and then SelFile looks at the directories being displayed to s
Vee
X    if they have been updated, and updates the display accordingly. Similarl
Vy,
X    file modes are checked (but not as often).
X
X* tilde (`7E) for home directories
X
X    When the user types a tilde at the beginning of the Text widget, SelFile
X    shows the home directories.
X
X----------------------------------------------------------------------------
V---
X
XThis work is loosely based on (and the name comes from) an earlier X10 SelFi
Vle
Xby Michiharu `60NinjaTerm' Ariza.
X
XAdmittedly, this X11 SelFile also looks a bit like the directory browser on
V the
XNeXT machine.
X
X----------------------------------------------------------------------------
V---
X
XIf you have any
X
X    porting problems
X
X    bug reports
X
X    comments (particularly about ideas in the TODO file)
X
X    or any other type of feedback
X
Xplease send mail to
X
X    erik@sra.co.jp
X                                           OR
X    erik%sra.co.jp@uunet.uu.net
X                                           OR
X    erik%sra.co.jp@mcvax.uucp
X                                           OR
X    try junet instead of co.jp
X                                           OR
X    Erik M. van der Poel
X    Software Research Associates, Inc.
X    1-1-1 Hirakawa-cho, Chiyoda-ku
X    Tokyo 102 Japan. TEL +81-3-234-2692
$ CALL UNPACK README.SELFILE;1 1870418563
$ create 'f'
XRelease notes for VMS changes to Ghostview
X8/18/92, Terry Poot <tp@mccall.com>
X
XIntroduction
X------------
X
XI've gotten Ghostview version 1.4 working on VMS 5.5, compiled with VAX C
Xv3.2, and using Ghostscript 2.4.1 and George Carrette's
X<gjc@mitech.com> port of the R5 Athena widgets.
X
XGhostscript availablility is, I believe, mentioned in the Ghostview readme
Xfiles.
X
XGeorge's kit for building the Athena widgets is available from
Xvmsnet.sources archive sites, including FTP from white.cerritos.edu
X`5B130.150.200.22`5D and acfcluster.nyu.edu , and mailserver access from
XMAILSERV@Cerritos.edu. (Send a message with 'help' in the body for
Xinstructions.) You will also need the directories mit/lib/Xmu and
Xmit/lib/Xaw from the MIT X11r5 source kit. I think you can get them from
Xexport.ai.mit.edu. I don't know of any non-FTP way other than finding a
Xfriend who can send them to you (that's what I did).
X
XThere's nothing I can think of in the changes to require any of these
Xspecific versions. I suspect it will work on VMS 5.0 or later, possibly
Xeven 4.7. I don't have any of these systems to test on, however. Also, any
XGhostscript supported by Ghostview should work, as NO changes were made to
XGhostscript to support Ghostview on VMS.
X
XI did this port specifically because I required a Postscript previewer for
Xmy current project, to preview files created by my applications. It is
Xlikely that anything I don't use hasn't been tested much, if at all.
XHowever, the relatively small number of changes is encouraging, and the
Xchanges themselves have all been tested.
X
XThe 2 large areas of changes are processing of print requests, and the
Xcommunications between Ghostview and Ghostscript. The changes to the print
Xcode are in the routine print_file in misc.c, and changes to the resources
Xused by that code are in main.c. Changes to the communications code are all
Xin the ghostview widget, which is in ghostview.c, with changes to the
Xwidget structure in ghostviewp.h. Most other changes were simple things
Xlike dealing with different include files to get the program to compile.
X
XBuilding
X--------
X
XThere are 2 build procedures provided. If you have MMS, you can use the
XDESCRIP.MMS description file. If not, there is a DCL procedure name
XVMS_BUILD.COM. The command procedure builds everything, whereas MMS will
Xonly build the things that have changed.`20
X
+-+-+-+-+-+-+-+-  END  OF PART 12 +-+-+-+-+-+-+-+-
Technical Details
Message-ID: <8881768@MVB.SAIC.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!usc!news.service.uci.edu!unogate!mvb.saic.com!vmsnet-sources

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!usc!news.service.uci.edu!unogate!mvb.saic.com!vmsnet-sources
Newsgroups: vmsnet.sources
From: Terry Poot <tp@mccall.com>
Subject: Ghostview for VMS 12/14
Message-ID: <8881768@MVB.SAIC.COM>
Date: Thu, 29 Oct 1992 18:50:06 GMT
Lines: 1334
Approved: Mark.Berryman@Mvb.Saic.Com