./mpage-2.5.6/0000755002342000001440000000000010742655637012151 5ustar marcelusers./mpage-2.5.6/TODO0000644002342000001440000001250107553630032012624 0ustar marcelusersCurrent Bug List: ================ - Processing Framemaker input (request from: delorme@panda.ceng.cea.fr) - When a input PS file contains NULL characters, mpage will go nuts... but you'll only see it when you try to print/gs its output. - Scaling should be done differently: 18/4 gives odd integers, so border lines and clipareas maybe off by one point... Try mpage -8 -H - When resizing with -W and -L, the header may become a mesh. Probably should not scale header with this... - CTRL-D characters at the beginning of a file are removed. Current Wish List: ================= - I18N support - Option to print line numbers before each line of text - It would be nice if the Makefile used sed on the man page to insert the user's PREFIX/share directory into the man page, rather than having /usr/local/share/mpage hard coded. - Build Configure script... - Build RPM package for mpage - Check out th -j option. Does not seem to work properly. maybe it is fixed with the multiple -j patches... - Add support to select paper trays. - Tidy up the manual page. Option description could be much better... - Allow printing of header for postscript-input also. Sort of request by Tobias Buchal - Better control of how pages are positioned on the page (David B. Peterson (dave@Spacestar.COM, Ted Stern Dave Lopez ) found a need for again a different layout. Guess we need something like: -<#c><#r>[[]]+ and pages are printed viewing as portrait from left to right from bottom to top, eg (proposing option -e): -e2c3rpu14l23n56 would print logical pages in 2 (short side) by 3 long side) rows: 1 and 4 in portrait, upside down 2 and 3 in landscape, upside down 5 and 6 in landscape, normal with logical page 1 in the lower left corner, page 4 in the lower right corner, page 2 in the middle row left, page 3 in the middle row right, page 5 in the top row left, page 6 in the top row right. - Definition of page location, landscape/portrait etc becomes spagetti. Need to redefine the way this is setup... - Define an option to leave some space between logical pages. suggested by: Jeremie PETIT petit@aurora.unice.fr - More flexible header definitions (size, fontname, which items where greying ...):,e.g.: mpage ... -H="grey=20% user=left filename=center pagenumber=right" ... suggested by: Jeremie PETIT petit@aurora.unice.fr - Define a (optional) physical page header with optionally a physical pagenumber. Also dates etc. Currently partly implemented: -X option. Could use some work on proper font (bold/not bold...) - Also might want a general pageframe around the logical pages. On top of this frame we can put the -X option output. - The postscript character encoding support is sort of a hack. I guess things could be a bit cleaner. - Support for reducing mpage output. I.E. if I do: mpage -8P file.txt | mpage -8 I should get 64-up output. Problems are that the PostScript code produced is not "recursive". The end-of-page macro in particular suffers under re-definition, you get blank pages. Another problems is resolution of the printer. See the next Wish item. - Better handeling of PostScript input. The current stuff works, but it is not general enough. I am currently learning more here, thanks to the "Green Book" and will work on a cleaner parser for Version 3. (Oh-my-goodness, a pre-announcement ;-) Perhaps I should convert the whole PostScript processing routing to be a "Finite Automata". Each line will represent a "token" parsed by its comment, output will be based upon transitions from state to state. The automata should allow states and transitions to be added dynamicly so that we can adapt to differening structure conventions, and differing PostScript code generators (psdit, dvi2ps, etc ...) - From: zachary brown When I use mpage on postscript files, the document's preexisting margins cause mpage to leave a lot of blank space in between each mini-page, thus causing it to shrink the pages more than necessary. My suggestion is this: allow the user to specify how much a mini-page can break out of the boundary mpage sets for it and overwrite what is on a neighboring mini-page. Also allow the user to specify how far along either end of the imaginary line connecting the upper left corner and the lower right corner of each minipage, the mini-page will be magnified. This way, since there would only be those extra margins poking into other space, nothing would in fact be overwritten, and mpage would magnify the tiny-pages to their optimal size, and (since the user would specify the edges to be magnified), there would be no problem with part of the mini-page being off the physical page. I came to be aware of this problem by trying to print out the gnu libc manual, and finding no way to avoid huge gaps between the mini-pages. - Add better timing information, possible adding command line arguments to control the amount of timing information added to the file. (Eyuk, more arguments:-( - Recognise things like c^Hc^Hc to be displayed in bold font... (underline works fine currently) - Lots more, I'm sure. ./mpage-2.5.6/Encoding.format0000644002342000001440000000146405632416210015076 0ustar marcelusersEncoding tables have the following format: Lines starting with % are regarded as comments and are ignored. Empty lines are also ignored (note: a line with only spaces or tabs is not an empty line) The first non-empty, non-comment line must contain 2 integers, specifying the first and last encoding number. Then the character encodings follow. This code is literally copied into the postscript stream, and should specify a font character vector. For example %%%% Part of ISO-Latin-1 encodings 32 40 % first and last encoding 032 /space 033 /exclam 034 /quotedbl 035 /numbersign 036 /dollar 037 /percent 038 /ampersand 039 /quoteright 040 /parenleft Any character of the input text files outside the first/last encoding range will be transformed to the \277 character. ./mpage-2.5.6/args.c0000644002342000234200000004741310056434011013341 0ustar marcelmarcel/* * args.c */ /* * mpage: a program to reduce pages of print so that several pages * of output appear on one printed page. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ #include "mpage.h" #include #include /* * Function declarations */ static char **slice(char *string, int *cntp); int do_args(int argc, char **argv, int envflag) { char *optstr; int consumed; int finished; int currarg; int opterrors; int i; opt_jarg = 0; for (i = 0; i < MAXJARG; i++) { opt_first[i] = 1; opt_last[i] = MAXINT; opt_alt[i] = 1; } #define OPTARG() \ { char opt = *optstr; \ consumed = 1; if(*++optstr == '\0') optstr = argv[++currarg]; \ if (!optstr) { fprintf (stderr, "%s: -%c: option requires argument\n", \ MPAGE, opt); return -1; } \ } opterrors = 0; finished = 0; for (currarg = 1; !finished && currarg < argc; currarg++) { if (*argv[currarg] != '-') { if (envflag) opterrors++; break; } optstr = argv[currarg]; consumed = 0; while (!consumed && *++optstr) { switch (*optstr) { default: fprintf(stderr, "%s: unknown option -%c\n", MPAGE, *optstr); opterrors++; break; case '-': finished = 1; break; case '1': sheetindex = 0; break; case '2': sheetindex = 1; break; case '4': sheetindex = 2; break; case '8': sheetindex = 3; break; case 'a': /* toggle between accross and updown */ sheetorder = sheetorder == LEFTRIGHT ? UPDOWN : LEFTRIGHT; break; case 'A': /* A4 sized, european paper */ opt_page = "A4"; /* deprecated */ break; case 'b': /* base paper type */ OPTARG(); /* see if user wants help */ if (!strcmp(optstr, "?") || !strcmp(optstr, "l")) { show_pagetypes(); exit(0); } /* set opt_page */ select_pagetype(optstr); break; case 'B': { int pb = 0; /* set a default */ consumed = 1; opt_textbox = 1 - opt_textbox; if (*++optstr == '\0') { break; } while (*optstr) { int sign; if (*optstr == '-') { sign = -1; optstr++; } else sign = 1; if (isdigit((int)*optstr)) { pb = *optstr - '0'; while (*++optstr && isdigit((int)*optstr)) pb = pb*10 + *optstr - '0'; } pb *= sign; switch (*optstr) { case 'l': textmargin_left = pb; break; case 'r': textmargin_right = pb; break; case 't': textmargin_top = pb; break; case 'b': textmargin_bottom = pb; break; case '\0':textbox.thick = pb; break; default: fprintf(stderr, "%s: Unknown -B box specifier: %c\n", MPAGE, *optstr); break; } if (*optstr) optstr++; } break; } case 'c': /* concat pages from different files on sheet */ opt_file = 1 - opt_file; break; case 'C': /* select character definitions */ consumed = 1; if (*++optstr) { /* did we get a encoding name ? */ if ((charvec_file = (char *) malloc(strlen(libdir) + strlen(optstr) + 2)) == NULL) { perror(optstr); fprintf(stderr, "ignoring character encoding definition\n"); } else { (void) strcpy(charvec_file, libdir); (void) strcat(charvec_file, "/"); (void) strcat(charvec_file, optstr); opt_encoding = 1; } } else /* no encoding name, toggle default one */ opt_encoding = 1 - opt_encoding; break; case 'd': OPTARG(); switch (*optstr) { case 'a': opt_input = IN_ASCII; break; case 'p': opt_input = IN_PS; break; default : fprintf(stderr, "ignoring input file type -d%c\n", *optstr); break; } break; case 'D': OPTARG(); dateformat = optstr; break; case 'e': /* GPN. for coli, 2,3,4,1(all) pages */ Coli = 3; opt_duplex = 1 - opt_duplex; break; case 'E': /* GPN. for coli, 2,3(inside) pages */ Coli = 2; break; case 'f': /* fold long lines */ opt_fold = 1 - opt_fold; break; case 'F': OPTARG(); fontname = optstr; break; case 'h': OPTARG(); opt_header = optstr; break; case 'H': opt_mp_header = 1; break; case 'I': OPTARG(); opt_indent = atoi(optstr); break; case 'j': /* Just these sheets */ OPTARG(); if (opt_jarg >= MAXJARG) { fprintf(stderr, "%s: to many j args (%d), ignoring %s\n", MPAGE, MAXJARG, optstr); break; } opt_first[opt_jarg] = isdigit((int)*optstr) ? strtol(optstr, &optstr, 10) : 1; if (*optstr == '-') { if (isdigit((int)*++optstr)) opt_last[opt_jarg] = strtol(optstr, &optstr, 10); } else opt_last[opt_jarg] = MAXINT; if (*optstr == '/' || *optstr == '%') opt_alt[opt_jarg] = atoi(++optstr); opt_jarg++; break; case 'J': OPTARG(); ps_pagenum = atoi(optstr) - 1; break; case 'k': /* toggle kill on trailer */ opt_killtrail = 1 - opt_killtrail; break; case 'l': /* landscape */ sheetaspect = sheetaspect == LANDSCAPE ? PORTRAIT : LANDSCAPE; break; case 'L': OPTARG(); opt_lines = atoi(optstr); break; case 'm': { int sm = 2*DEFAULTSMARGIN; /* set a default */ consumed = 1; if (*++optstr == '\0') { sheetmargin_left = sm; #if defined(ALL_MARGINS) sheetmargin_right = sm; sheetmargin_top = sm; sheetmargin_bottom = sm; #endif break; } while (*optstr) { int sign; if (*optstr == '-') { sign = -1; optstr++; } else sign = 1; if (isdigit((int)*optstr)) { sm = *optstr - '0'; while (*++optstr && isdigit((int)*optstr)) sm = sm*10 + *optstr - '0'; } sm *= sign; switch (*optstr) { case 'l': sheetmargin_left = sm; break; case 'r': sheetmargin_right = sm; break; case 't': sheetmargin_top = sm; break; case 'b': sheetmargin_bottom = sm; break; case '\0':sheetmargin_left = sm; sheetmargin_right = sm; sheetmargin_top = sm; sheetmargin_bottom = sm; break; default: fprintf(stderr, "%s: Unknown -m margin specifier: %c\n", MPAGE, *optstr); break; } if (*optstr) optstr++; } break; } case 'M': { int pm = 2*DEFAULTPMARGIN; /* set a default */ consumed = 1; if (*++optstr == '\0') { pagemargin_left = pm; #if defined(ALL_MARGINS) pagemargin_right = pm; pagemargin_top = pm; pagemargin_bottom = pm; #endif break; } while (*optstr) { int sign; if (*optstr == '-') { sign = -1; optstr++; } else sign = 1; if (isdigit((int)*optstr)) { pm = *optstr - '0'; while (isdigit((int)*++optstr)) pm = pm*10 + *optstr - '0'; } pm *= sign; switch (*optstr) { case 'l': pagemargin_left = pm; break; case 'r': pagemargin_right = pm; break; case 't': pagemargin_top = pm; break; case 'b': pagemargin_bottom = pm; break; case '\0':pagemargin_left = pm; pagemargin_right = pm; pagemargin_top = pm; pagemargin_bottom = pm; break; default: fprintf(stderr, "%s: Unknown -M margin specifier: %c\n", MPAGE, *optstr); break; } if (*optstr) optstr++; } break; } case 'o': /* toggle print outlines */ opt_outline = 1 - opt_outline; break; case 'O': /* GPN. for coli, 4,1(outside) pages */ Coli = 1; break; case 'p': /* pr */ opt_pr = 1; consumed = 1; if (*++optstr) prprog = optstr; break; case 'P': /* Printer */ consumed = 1; doprint = 1; if (*++optstr) { if (*optstr == '-' && *(optstr+1) == '\0') doprint = 0; /* kill MPAGE envvar que setting*/ else printque = optstr; } break; case 'r': opt_reverse = 1; break; case 'R': /* reorient */ sheetaspect = LANDSCAPE_PORTRAIT; break; case 's': /* tab Stops */ OPTARG(); if ((opt_tabstop = atoi(optstr)) < 2) opt_tabstop = DEFAULTTABSTOP; break; case 'S': opt_square = 0; break; case 't': opt_duplex = 1 - opt_duplex; break; case 'T': opt_tumble = 1 - opt_tumble; break; case 'u': check_utf8 = 1 - check_utf8; break; case 'U': /* Letter sized, US paper */ opt_page = "Letter"; /* deprecated */ break; case 'v': /* verbose (print page count) */ opt_verbose = 1 - opt_verbose; break; case 'V': /* Version */ fprintf(stderr, "mpage version %s\n", VERSION); exit(0); break; case 'W': OPTARG(); opt_width = atoi(optstr); break; case 'x': /* force usage. Could be extended to usagelevel */ opterrors = 1; break; case 'X': opt_sheetheader = 1; consumed = 1; if (*++optstr) sheethead = optstr; break; case 'z': OPTARG(); printprog = optstr; break; case 'Z': OPTARG(); printarg = optstr; break; } } } /* * Just NOW set the page size parameters */ set_page(); if (opterrors) return -1; return currarg; } /* do_args */ int do_env() { int argc; char **argv; char *copy; char *env; #if SPOOLER == ATT_SPOOLER if ((env = getenv("LPDEST")) != NULL) #elif SPOOLER == BSD_SPOOLER if ((env = getenv("PRINTER")) != NULL) #endif printque = env; if ((env = getenv("MPAGE_LIB")) != NULL) libdir = env; if ((env = getenv("MPAGE")) != NULL) { if ((copy = strdup(env)) == NULL) { fprintf(stderr, "%s: Unable to alloc memory for environment args\n", MPAGE); return -1; } argv = slice(copy, &argc); if (do_args(argc, argv, 1) < 0) { fprintf(stderr, "%s: error in environment \"%s\"\n", MPAGE, env); return -1; } } return 0; } /* do_env */ #define ARGCNT 20 char *slc_argv[ARGCNT+1]; static char ** slice(char *string, int *cntp) { int count; /* * mimic the shell for conformity */ slc_argv[0] = MPAGE; count = 1; /* * while there are still characters to be processed */ while (*string && count < ARGCNT) { /* * skip any leading or leftover white space */ while (*string == ' ') string++; /* * make sure we had more than just white space before * we believe we actually have an argument */ if (*string) { /* * point the next slot in argv to this string */ slc_argv[count++] = string; /* * and go looking for the end of this string * which is delienated by a space or NULL */ while (*string && *string != ' ') string++; /* * if this not the end of the string, then convert * the space into a NULL and move forward one byte. * if this is the end of the string, we already have * a suitable NULL byte for the string and it also * drops us out of all the loops */ if (*string) { *string = '\0'; string++; } } } /* * return the count via the integer pointer we were given * and put a null pointer into the argv array for conformity */ if (*string && count == ARGCNT) fprintf(stderr, "%s: to many options in MPAGE environment variable, skipping '%s'\n", MPAGE, string); slc_argv[count] = 0; *cntp = count; return slc_argv; } /* slice */ ./mpage-2.5.6/Contrib/0000755002342000001440000000000006437367656013560 5ustar marcelusers./mpage-2.5.6/Contrib/mp0000644002342000001440000000307106124461620014073 0ustar marcelusers#!/bin/sh - # # REMARKS: # # Useful stuff for Ghostview in .Xdefaults: # # Ghostview*printCommand: /users/franky/bin/psprint # Ghostview*swapLandscape: true # Ghostview*horizontalMargin: 10 # Ghostview*verticalMargin: 10 # # Useful environment variables: # # LPDEST=hp4 # TMPFILE=/tmp/mp$$.ps MPAG=/usr/local/bin/mpage PSPRINT=/usr/local/bin/psprint GV=/usr/local/bin/ghostview RM=/bin/rm Help() { cat << "EOF" mp -- view or print using mpage To print a file: mp -p [-{1,2,4,8}] [mpage-options] file To view a file: mp [-v[{0,1,2,3}]] [-{1,2,4,8}] [mpage-options] file Options: -p print a file -v view file at magstep -1 (default) -v0 view file at magstep 0 -v1 view file at magstep -1 -v2 view file at magstep -2 -v3 view file at magstep -3 -1 view/print one page per screen -2 view/print two pages per screen -4 view/print four pages per screen (default) -8 view/print eight pages per screen mpage-options are passed to mpage EOF } if [ "$1" = "" ]; then Help exit 1 fi PRINTING=0 MAGSTEP=1 case $1 in -h) Help ; exit 1 ;; -p) PRINTING=1 ; shift ;; -v) MAGSTEP=1 ; shift ;; -v0) MAGSTEP=0 ; shift ;; -v1) MAGSTEP=1 ; shift ;; -v2) MAGSTEP=2 ; shift ;; -v3) MAGSTEP=3 ; shift ;; esac MARGIN=l case $1 in -2) MARGIN=r ;; -8) MARGIN=r ;; esac # ASSUMED OPTIONS IN EFFECT: -H -f -A -a # ${MPAG} -m20lbrt -m50"${MARGIN}" $* > $TMPFILE # if [ "${PRINTING}" = "1" ]; then ${PPSPRINT} $TMPFILE else ${GV} -magstep -"${MAGSTEP}" $TMPFILE fi ${RM} -f $TMPFILE exit 0 ./mpage-2.5.6/Contrib/psprint0000644002342000001440000000066006124463707015167 0ustar marcelusers#!/bin/ksh - STDIN_TMP_FILE=/tmp/psprint.$$ GS=/usr/local/bin/gs GSLIB=/usr/local/lib/ghostscript/3.53 RM=/bin/rm # # define print command (SYSV or BSD ish) # PRINT="lp -or -s" PRINT=lpr if [ $# -eq 0 ]; then cat > "${STDIN_TMP_FILE}" set "${STDIN_TMP_FILE}" fi for i in $* ; do ${GS} -sDEVICE=ljet4 -r600 -sOutputFile="|${PRINT}" -q -DNOPAUSE "$i" \ ${GSLIB}/quit.ps done ${RM} -f "${STDIN_TMP_FILE}" exit 0 ./mpage-2.5.6/Contrib/mergeps.lex0000644002342000001440000000204106436364265015721 0ustar marcelusers%{ /* * merge.l - Flex source * Merges two PostScript files * */ #include #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif YY_BUFFER_STATE file1, file2; int second_is_open = 0; FILE *fp1, *fp2; %} %option noyywrap %x SECOND_FILE %% ^showsheet { printf("%%%%SHOWSHEET IN FIRST FILE: Removed!\n"); BEGIN(SECOND_FILE); if ( !second_is_open ){ second_is_open = 1; file1 = YY_CURRENT_BUFFER; yyin = fp2; file2 = yy_create_buffer(yyin, YY_BUF_SIZE); } yy_switch_to_buffer(file2); } ^showpage { printf("%%%%Next line renders the merged page.\nshowsheet\n"); BEGIN(INITIAL); yy_switch_to_buffer(file1); } %% void yyerror(char *msg) { fprintf(stderr, "Error...\n"); exit(1); } main(int argc, char *argv[]) { if ( (fp1 = fopen(argv[1], "r")) == NULL ){ fprintf(stderr, "%s: file not found!\n", argv[1]); exit(1); } if ( (fp2 = fopen(argv[2], "r")) == NULL ){ fprintf(stderr, "%s: file not found!\n", argv[2]); exit(1); } yyin = fp1; yylex(); exit(0); } ./mpage-2.5.6/Contrib/mergeps.txt0000644002342000001440000000271606436365400015751 0ustar marcelusersFrom: Miguel Guimaraes Date: Mon, 12 May 1997 12:01:47 I want to merge two ps files in this way: +-----------------------------+ +-----------------------------+ |nice header with pictures | | | | | | | | | + | ps generated by mpage | = | | | | |nice footer with page number | | | +-----------------------------+ +-----------------------------+ +-----------------------------+ |nice header with pictures | | | | ps generated by mpage | | | |nice footer with page number | +-----------------------------+ Merging two ps files I have an 'had hoc' solution that works in this way: - Header and Footer are generated in ms-word and printed in file1.ps Then 'mpage [options] file1.ps > file1.ps.mp' - The second file is generated by mpage (text _only_) 'text.ps' - The merged file: 'mergeps file1.ps.mp text.ps > merged.ps' (The order of arguments is important; header and footer must come first) It doesn't intend to be more than a little aproach for a _specific_ task and works (I didn't test it very hard :-) fine. It is in flex source, 'mergeps.lex' Best Regards, M.Guimaraes To use this: flex mergeps.lex cc lex.yy.c -o mergeps ./mpage-2.5.6/Contrib/mfix/0000755002342000001440000000000005752770144014510 5ustar marcelusers./mpage-2.5.6/Contrib/mfix/README0000644002342000001440000000107504706450122015360 0ustar marcelusersThis is a fix to mpage that makes it work with ArborText called "mfix". To compile it just type: cc mfix.c -o mfix To use this as a fix to mpage, just pipe the mpage output through stdin and it will send the corrected output to stdio.. For example, try it on the file "test.ps", by typing : mpage -2 -P test.ps | mfix | lpr and the file should be sent to the printer.. Note: This program might mess up if you aren't using Arbortext.. So if it doesn't print out correctly check the source.. Any bugs or problems contact. Todd R. Kaplan todd@atlas.socsci.umn.edu./mpage-2.5.6/Contrib/mfix/mfix.c0000644002342000001440000000142004706450125015604 0ustar marcelusers#include FILE *in=stdin,*out=stdout; char line[200]; line2[200]; int strcp(st1,st2) char *st1,*st2; { int n; n=strncmp(st1,st2,strlen(st2)); return(n); } main() { int i; for(i=0; i<10; i=1) { if (fgets(line,200,in)==NULL) { close(in); close(out); exit(1); } if (strcp(line,"%%BeginSetup")==0) { fgets(line,200,in); fgets(line,200,in); continue; } if (strcp(line,"%%PageBoundingBox: (at")==0) { fprintf(out,"BeginDviLaserDoc\n"); fprintf(out,"300 300 RES\n"); fprintf(out,"%s",line); continue; } if (strcp(line,"%%PageBoundingBox:")==0) { fprintf(out,"%s",line); fprintf(out,"EndDviLaserDoc\n"); continue; } fprintf(out,"%s",line); } } ./mpage-2.5.6/Contrib/mfix/test.ps0000444002342000001440000005536304706450134016035 0ustar marcelusers%!PS-Adobe-2.0 %%Title: TeX output 1990.08.22:1726 %%Creator: DVILASER/PS, ArborText, Inc. %%BoundingBox: (atend) %%Pages: (atend) %%DocumentFonts: (atend) %%EndComments %! % Dvips.pro - included prolog for DviLaser-generated PostScript files. % % Copyright (c) 1986-89, ArborText, Inc. % Permission to copy is granted so long as the PostScript code % is not resold or used in a commercial product. % % $Header: dvips.pro.dist,v 1.17 90/05/25 10:47:18 jsg Exp $ systemdict /setpacking known % use array packing mode if its available {/savepackingmode currentpacking def true setpacking} if /$DviLaser 400 dict def % Begin document /BeginDviLaserDoc { vmstatus pop pop 0 eq { $DviLaser begin InitializeState } { /DviLaserJob save def $DviLaser begin InitializeState /DviLaserFonts save def } ifelse } bind def % End document /EndDviLaserDoc { vmstatus pop pop 0 eq { end } { DviLaserFonts restore end DviLaserJob restore } ifelse } bind def $DviLaser begin /tempstr 64 string def /tempint 0 def /tempmatrix matrix def % % Debugging routines % /DebugMode false def /PrintInt { tempstr cvs print } bind def /PrintLn { (\n) print flush } bind def /PrintVMStats { print PrintLn (VM status - ) print vmstatus 3 copy PrintInt (\(total\), ) print PrintInt (\(used\), ) print pop exch sub PrintInt (\(remaining\), ) print PrintInt (\(level\)) print PrintLn } bind def /VMS /PrintVMStats load def /VMSDebug { DebugMode {PrintVMStats} {pop} ifelse } bind def (beginning of common prolog) VMSDebug % Make it easy to bind definitions. /bdef { bind def } bind def /xdef { exch def } bdef % Begin page /BP { /Magnification xdef /DviLaserPage save def (beginning of page) VMSDebug } bdef % End page /EP { DviLaserPage restore } bdef % Exit page (temporarily) to add fonts/characters. /XP { % Save current point information so it can be reset later. /Xpos where {pop Xpos} {0} ifelse /Ypos where {pop Ypos} {0} ifelse /currentpoint cvx stopped {0 0 moveto currentpoint} if /DviLaserPage where {pop DviLaserPage restore} if moveto /Ypos xdef /Xpos xdef } bdef % Resume page /RP { /DviLaserPage save def } bdef % Purge all fonts to reclaim memory space. /PF { GlobalMode LocalMode } bdef % Switch to base save/restore level, saving state information. /GlobalMode { /UserSave where {pop UserSave} if % invoke "UserSave" if available PortraitMode PaperWidth PaperHeight PxlResolution Resolution Magnification Ymax RasterScaleFactor % Save current point information so it can be reset later. /currentpoint cvx stopped {0 0 moveto currentpoint} if /DviLaserPage where {pop DviLaserPage restore} if DviLaserFonts restore RecoverState } bdef % Preserve state at the base level. /RecoverState { 10 copy /Ypos xdef /Xpos xdef /RasterScaleFactor xdef /Ymax xdef /Magnification xdef /Resolution xdef /PxlResolution xdef /PaperHeight xdef /PaperWidth xdef /PortraitMode xdef DoInitialScaling PortraitMode not {PaperWidth 0 SetupLandscape} if Xpos Ypos moveto } bdef % Initialize state variables to default values. /InitializeState { /Resolution 3600.0 def /PxlResolution 300.0 def /RasterScaleFactor PxlResolution Resolution div def /PortraitMode true def 11.0 Resolution mul /PaperHeight xdef 8.5 Resolution mul /PaperWidth xdef /Ymax PaperHeight def /Magnification 1000.0 def /Xpos 0.0 def /Ypos 0.0 def /InitialMatrix matrix currentmatrix def } bdef % Switch from base save/restore level, restoring state information. /LocalMode { /Ypos xdef /Xpos xdef /RasterScaleFactor xdef /Ymax xdef /Magnification xdef /Resolution xdef /PxlResolution xdef /PaperHeight xdef /PaperWidth xdef /PortraitMode xdef DoInitialScaling PortraitMode not {PaperWidth 0 SetupLandscape} if Xpos Ypos moveto /UserRestore where {pop UserRestore} if % invoke "UserRestore" if available /DviLaserFonts save def /DviLaserPage save def } bdef % Abbreviations /S /show load def /SV /save load def /RST /restore load def /Yadjust {Ymax exch sub} bdef % (x,y) position absolute, just set Xpos & Ypos, don't move. /SXY { Yadjust /Ypos xdef /Xpos xdef } bdef % (x,y) position absolute /XY { Yadjust 2 copy /Ypos xdef /Xpos xdef moveto } bdef % (x,0) position absolute /X { currentpoint exch pop 2 copy /Ypos xdef /Xpos xdef moveto } bdef % (0,y) position absolute /Y { currentpoint pop exch Yadjust 2 copy /Ypos xdef /Xpos xdef moveto } bdef % (x,y) position relative /xy { neg rmoveto currentpoint /Ypos xdef /Xpos xdef } bdef % (x,0) position relative /x { 0.0 rmoveto currentpoint /Ypos xdef /Xpos xdef } bdef % (0,y) position relative /y { 0.0 exch neg rmoveto currentpoint /Ypos xdef /Xpos xdef } bdef % Print a rule. In order to get correct pixel size and positioning, % we usually create a temporary font in which the rule is the only character. % When the rule is large, however, we fill a rectangle instead. /R { /ht xdef /wd xdef ht 1950 le wd 1950 le and {save /tfd 6 dict def tfd begin /FontType 3 def /FontMatrix [1 0 0 1 0 0] def /FontBBox [0 0 wd ht] def /Encoding 256 array dup 97 /a put def /BuildChar { pop % ignore character code pop % ignore font dict, too wd 0 0 0 wd ht setcachedevice wd ht true [1 0 0 -1 0 ht] {} imagemask } def end % tfd /tf tfd definefont setfont (a) show restore } {gsave 0 setgray currentpoint newpath moveto 0.0 ht rlineto wd 0.0 rlineto 0.0 ht neg rlineto wd neg 0.0 rlineto closepath fill grestore } ifelse wd 0.0 rmoveto currentpoint /Ypos xdef /Xpos xdef } bdef % % RES % /RES { /Resolution xdef /PxlResolution xdef /RasterScaleFactor PxlResolution Resolution div def DoInitialScaling } bdef % % Do initial scaling. % /DoInitialScaling { InitialMatrix setmatrix 72.0 Resolution div dup scale } bdef % % PM % /PM { XP /PaperWidth xdef /PaperHeight xdef /Ymax PaperHeight def /PortraitMode true def DoInitialScaling RP } bdef % % LM % /LM { XP /PaperWidth xdef /PaperHeight xdef /Ymax PaperWidth def /PortraitMode false def DoInitialScaling PaperWidth 0 SetupLandscape RP } bdef % Change magnification setting /MAG { XP /Magnification xdef RP } bdef % % Switch to landscape mode % /SetupLandscape { translate 90.0 rotate } bdef % % SPB - begin "\special" mode % % This is the PostScript procedure used to transfer from the internal % environment used for the DVI translation code emitted by DVIPS to % a standard PostScript environment. % % Parameters: 0 - Local % 1 - Global % 2 - Inline % /SPB { /spc_mode xdef spc_mode 0 eq spc_mode 2 eq or {XP} {spc_mode 1 eq {GlobalMode} if} ifelse Resolution 72.0 div dup scale % Restore default scaling... Magnification 1000.0 div dup scale % Adjust for any magnification... /Xpos Xpos 72.0 Resolution div mul 1000.0 Magnification div mul def /Ypos Ypos 72.0 Resolution div mul 1000.0 Magnification div mul def } bdef % % SPE - end "\special" mode % % This is the PostScript procedure used to reenter the internal % environment used for the DVI translation code emitted by DVIPS from % the standard PostScript environment provided for processing user-supplied % PostScript code. % % Parameters: 0 - Local % 1 - Global % 2 - Inline % /SPE { /spc_mode xdef 1000.0 Magnification div dup scale % Un-adjust for any magnification... 72.0 Resolution div dup scale % Restore default internal scaling... spc_mode 0 eq spc_mode 2 eq or {RP} {spc_mode 1 eq {LocalMode} if} ifelse } bdef % % PP % /PP { /#copies xdef showpage /#copies 1 def } bdef % % /font-name DMF % /DMF { /psz xdef /nam xdef nam findfont psz scalefont setfont } bdef % % /abcd (xxx) str-concat ==> /abcdxxx % /str-concatstr 64 string def /str-concat { /xxx xdef /nam xdef /namstr nam str-concatstr cvs def /newnam namstr length xxx length add string def newnam 0 namstr putinterval newnam namstr length xxx putinterval newnam cvn } bdef % % /abcdef 2 str-strip ==> /cdef % /str-strip { /num xdef /nam xdef /namstr nam tempstr cvs def /newlen namstr length num sub def namstr num newlen getinterval cvn } bdef % % copydict ==> new-dict on stack % /copydict { dup length 1 add dict /newdict xdef {1 index /FID ne {newdict 3 1 roll put} {pop pop} ifelse } forall newdict } bdef % % DefineCMEncoding % /DefineCMEncoding { /EncodeType xdef /CMEncoding 256 array def /Times-Roman findfont /Encoding get aload pop CMEncoding astore pop EncodeType 11 eq {Do-CM-rm-encoding} if EncodeType 12 eq {Do-CM-it-encoding} if EncodeType 13 eq {Do-CM-tt-encoding} if } bdef % % Do special mappings for the various CM-font types. Characters that % get "covered up" are repositioned in the range (128,128+32). % /Do-standard-CM-encodings { CMEncoding dup 0 /.notdef put dup 1 /.notdef put dup 2 /.notdef put dup 3 /.notdef put dup 4 /.notdef put dup 5 /.notdef put dup 6 /.notdef put dup 7 /.notdef put dup 8 /.notdef put dup 9 /.notdef put dup 10 /.notdef put dup 11 /.notdef put dup 12 /fi put dup 13 /fl put dup 14 /.notdef put dup 15 /.notdef put dup 16 /dotlessi put dup 17 /.notdef put dup 18 /grave put dup 19 /acute put dup 20 /caron put dup 21 /breve put dup 22 /macron put dup 23 /ring put dup 24 /cedilla put dup 25 /germandbls put dup 26 /ae put dup 27 /oe put dup 28 /oslash put dup 29 /AE put dup 30 /OE put dup 31 /Oslash put dup 127 /dieresis put dup 128 /space put dup 129 /quotedbl put dup 130 /sterling put dup 131 /dollar put dup 132 /less put dup 133 /greater put dup 134 /backslash put dup 135 /asciicircum put dup 136 /underscore put dup 137 /braceleft put dup 138 /bar put dup 139 /braceright put dup 140 /asciitilde put pop } bdef /Do-CM-rm-encoding { Do-standard-CM-encodings CMEncoding dup 32 /.notdef put dup 34 /quotedblright put dup 60 /exclamdown put dup 62 /questiondown put dup 92 /quotedblleft put dup 94 /circumflex put dup 95 /dotaccent put dup 123 /endash put dup 124 /emdash put dup 125 /hungarumlaut put dup 126 /tilde put pop } bdef /Do-CM-it-encoding { Do-standard-CM-encodings CMEncoding dup 32 /.notdef put dup 34 /quotedblright put dup 36 /sterling put dup 60 /exclamdown put dup 62 /questiondown put dup 92 /quotedblleft put dup 94 /circumflex put dup 95 /dotaccent put dup 123 /endash put dup 124 /emdash put dup 125 /hungarumlaut put dup 126 /tilde put pop } bdef /Do-CM-tt-encoding { Do-standard-CM-encodings CMEncoding dup 12 /.notdef put dup 13 /quotesingle put dup 14 /exclamdown put dup 15 /questiondown put dup 94 /circumflex put dup 126 /tilde put pop } bdef % % Routines to handle packing/unpacking numbers. % % PackHW --> % /PackHW { /num xdef /pos xdef /target xdef num 16#0000FFFF and 1 pos sub 16 mul bitshift target or } bdef % % PackByte --> % /PackByte { /num xdef /pos xdef /target xdef num 16#000000FF and 3 pos sub 8 mul bitshift target or } bdef % % UnpkHW --> % /UnpkHW { /num xdef /pos xdef num 1 pos sub -16 mul bitshift 16#0000FFFF and dup 16#00007FFF gt {16#00010000 sub} if } bdef % % UnpkByte --> % /UnpkByte { /num xdef /pos xdef num 3 pos sub -8 mul bitshift 16#000000FF and dup 16#0000007F gt {16#00000100 sub} if } bdef % % DefineCMFont % % type 10: "as-is" PostScript font % type 11: CM-mapped PostScript font - roman % type 12: CM-mapped PostScript font - text italic % type 13: CM-mapped PostScript font - typewriter type % /int-dict-name {int (-dict) str-concat} bdef /int-dict {int (-dict) str-concat cvx load} bdef /DF { true % signal that the font is already loaded DefineCMFont } bdef /DNF { false % signal that the font is not already loaded DefineCMFont } bdef /DefineCMFont { /loaded xdef /typ xdef /psz xdef /ext xdef /int xdef typ 10 ne { % font_type = 11, 12, 13 loaded not { /fnam ext 3 str-strip def fnam findfont copydict /newdict xdef typ DefineCMEncoding newdict /Encoding CMEncoding put ext newdict definefont pop } if int-dict-name ext findfont psz scalefont def currentdict int [int-dict /setfont cvx] cvx put } { % font_type = 10 /fnam ext def int-dict-name fnam findfont psz scalefont def currentdict int [int-dict /setfont cvx] cvx put } ifelse } bdef % % % [llx lly urx ury] DefinePXLFont % /PXLF { true % signal that the font is already loaded DefinePXLFont } bdef /PXLNF { false % signal that the font is not already loaded DefinePXLFont } bdef /PXLBuildCharDict 17 dict def /CMEncodingArray 256 array def 0 1 255 {CMEncodingArray exch dup tempstr cvs cvn put} for /RasterConvert {RasterScaleFactor div} bdef /TransformBBox { aload pop /BB-ury xdef /BB-urx xdef /BB-lly xdef /BB-llx xdef [BB-llx RasterConvert BB-lly RasterConvert BB-urx RasterConvert BB-ury RasterConvert] } bdef /DefinePXLFont { /newfont xdef /bb xdef /num xdef /psz xdef /dsz xdef /pxlmag xdef /ext xdef /int xdef /fnam ext (-) str-concat pxlmag tempstr cvs str-concat def newfont not { int-dict-name 13 dict def int-dict begin /FontType 3 def /FontMatrix [1 dsz div 0 0 1 dsz div 0 0] def /FontBBox bb TransformBBox def /Encoding CMEncodingArray def /CharDict 1 dict def CharDict begin /Char-Info num array def end /BuildChar { PXLBuildCharDict begin /char xdef /fontdict xdef fontdict /CharDict get /Char-Info get char get aload pop /rasters xdef /PackedWord1 xdef 0 PackedWord1 UnpkHW 16#7FFF ne { /PackedWord2 xdef /wx 0 PackedWord1 UnpkHW def /rows 2 PackedWord1 UnpkByte def /cols 3 PackedWord1 UnpkByte def /llx 0 PackedWord2 UnpkByte def /lly 1 PackedWord2 UnpkByte def /urx 2 PackedWord2 UnpkByte def /ury 3 PackedWord2 UnpkByte def } { /PackedWord2 xdef /PackedWord3 xdef /PackedWord4 xdef /wx 1 PackedWord1 UnpkHW def /rows 0 PackedWord2 UnpkHW def /cols 1 PackedWord2 UnpkHW def /llx 0 PackedWord3 UnpkHW def /lly 1 PackedWord3 UnpkHW def /urx 0 PackedWord4 UnpkHW def /ury 1 PackedWord4 UnpkHW def } ifelse rows 0 lt { /rows rows neg def /runlength 1 def } { /runlength 0 def } ifelse wx 0 llx RasterConvert lly RasterConvert urx RasterConvert ury RasterConvert setcachedevice rows 0 ne { gsave cols rows true RasterScaleFactor 0 0 RasterScaleFactor neg llx neg ury tempmatrix astore {GenerateRasters} imagemask grestore } if end } def end fnam int-dict definefont pop } if int-dict-name fnam findfont psz scalefont def currentdict int [int-dict /setfont cvx] cvx put } bdef % % PXLC % /PXLC { /rasters xdef /runlength xdef /cols xdef /rows xdef /ury xdef /urx xdef /lly xdef /llx xdef /wx xdef /code xdef /int xdef % See if the long or short format is required true cols CKSZ rows CKSZ ury CKSZ urx CKSZ lly CKSZ llx CKSZ TackRunLengthToRows { int-dict /CharDict get /Char-Info get code [0 0 llx PackByte 1 lly PackByte 2 urx PackByte 3 ury PackByte 0 0 wx PackHW 2 rows PackByte 3 cols PackByte rasters] put} { int-dict /CharDict get /Char-Info get code [0 0 urx PackHW 1 ury PackHW 0 0 llx PackHW 1 lly PackHW 0 0 rows PackHW 1 cols PackHW 0 0 16#7FFF PackHW 1 wx PackHW rasters] put} ifelse } bdef /CKSZ {abs 127 le and} bdef /TackRunLengthToRows {runlength 0 ne {/rows rows neg def} if} bdef % % PLOTC % /PLOTC { /rasters xdef /runlength xdef /cols xdef /rows xdef /ury xdef /urx xdef /lly xdef /llx xdef /psz xdef /dsz xdef /wx xdef % "Plot" a character's raster pattern. rows 0 ne { gsave currentpoint translate psz dsz div dup scale cols rows true RasterScaleFactor 0 0 RasterScaleFactor neg llx neg ury tempmatrix astore {GenerateRasters} imagemask grestore } if wx x } bdef % Routine to generate rasters for "imagemask". /GenerateRasters { rasters runlength 1 eq {RunLengthToRasters} if } bdef % Routine to convert from runlength encoding back to rasters. /RunLengthToRasters { % ...not done yet... } bdef % % These procedures handle bitmap processing. % % BMbeg % /BMbeg { /BMmagnification xdef /BMresolution xdef /BMrows xdef /BMcols xdef /BMcurrentrow 0 def gsave 0.0 setgray Resolution BMresolution div dup scale currentpoint translate BMmagnification 1000.0 div dup scale 0.0 BMrows moveto BMrows dup scale currentpoint translate /BMCheckpoint save def } bdef /BMend { BMCheckpoint restore grestore } bdef % % BMswath % /BMswath { /rows xdef /rasters xdef BMcols rows true [BMrows 0 0 BMrows neg 0 BMcurrentrow neg] {rasters} imagemask /BMcurrentrow BMcurrentrow rows add def BMcurrentrow % save this on the stack around a restore... BMCheckpoint restore /BMcurrentrow xdef /BMCheckpoint save def } bdef % % Procedures for implementing the "rotate " special: % ROTB - % - ROTE - /ROTB { XP gsave Xpos Ypos translate rotate % using from the stack Xpos neg Ypos neg translate RP } bdef /ROTE {XP grestore RP} bdef % % Procedures for implementing the "epsfile []" special: % EPSB - % - EPSE - /EPSB { 0 SPB save 4 1 roll % push the savelevel below the parameters /showpage {} def Xpos Ypos translate 1000 div dup scale % using from the stack neg exch neg exch translate % using from the stack } bdef /EPSE {restore 0 SPE} bdef % % Procedure for implementing revision bars: % REVB - % The bar is a line of width barw drawn from (barx,bary1) to (barx,bary2). /REVB { /barw xdef /barx xdef /bary2 xdef /bary1 xdef gsave barw setlinewidth barx bary1 Yadjust moveto barx bary2 Yadjust lineto stroke grestore } bdef % % A small array and two procedures to facilitate The Publisher's % implementation of gray table cells: % GRSP - % GRFB - % % GRSP saves the current DVI location so that it can be retrieved later % by the index . GRFB fills a box whose corners are given by the % indexes and with a halftone gray with the given % level and frequency. The array GRPM holds the coordinates of points % marking the corners of gray table cells. /GRPM 40 dict def /GRSP {GRPM exch [Xpos Ypos] put} bdef /GRFB { /GRfreq xdef /GRgraylev xdef GRPM exch get aload pop /GRlry xdef /GRlrx xdef GRPM exch get aload pop /GRuly xdef /GRulx xdef gsave % set the screen frequency if it isn't zero GRfreq 0 ne {currentscreen 3 -1 roll pop GRfreq 3 1 roll setscreen} if % set the gray level GRgraylev setgray % draw and fill the path GRulx GRuly moveto GRlrx GRuly lineto GRlrx GRlry lineto GRulx GRlry lineto closepath fill grestore } bdef % % Procedures for implementing the "paper " option: % SPS - % paper-manual - % etc. The boolean is passed so that a paper source procedure % knows if it is being called at the beginning (false) or end % (true) of a page. /SPS { /eop xdef /name xdef name where {pop eop name cvx exec} if } bdef /paper-manual { {statusdict /manualfeed known {statusdict /manualfeed true put} if} if } bdef /paper-automatic { {statusdict /manualfeed known {statusdict /manualfeed false put} if} if } bdef /paper-top-tray { {} {statusdict /setpapertray known {statusdict begin gsave 0 setpapertray grestore end} if} ifelse } bdef /paper-bottom-tray { {} {statusdict /setpapertray known {statusdict begin gsave 1 setpapertray grestore end} if} ifelse } bdef /paper-both-trays { {} {statusdict /setpapertray known {statusdict begin gsave 2 setpapertray grestore end} if} ifelse } bdef (end of common prolog) VMSDebug end systemdict /setpacking known {savepackingmode setpacking} if % % End of included prolog section. % %%EndProlog %%BeginSetup BeginDviLaserDoc 300 300 RES %%EndSetup %%Page: 1 1 %%PageBoundingBox: (atend) %%BeginPageSetup 1000 BP 3300 2550 PM /paper-automatic false SPS 383 0 XY %%EndPageSetup XP /F0 /cmr10 300 41.5 41.5 128 [-3 -11 41 31] PXLNF RP XP /F0 65 31 1 0 29 29 29 32 0 <00060000 00060000 00060000 000F0000 000F0000 000F0000 00178000 00178000 00178000 0023C000 0023C000 0023C000 0041E000 0041E000 0041E000 0080F000 0080F000 0180F800 01007800 01FFF800 03007C00 02003C00 02003C00 06003E00 04001E00 04001E00 0C001F00 1E001F00 FF80FFF0> PXLC RP 383 342 XY F0(AAAAAA)S XP /F0 49 21 4 0 17 28 28 16 0 <0300 0700 3F00 C700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0700 0F80 FFF8> PXLC RP 1265 3070 XY F0(1)S %%PageTrailer PF /paper-automatic true SPS 1 PP EP %%PageBoundingBox: 92 53 308 717 %%Trailer EndDviLaserDoc %%BoundingBox: 92 53 308 717 %%Pages: 1 %%DocumentFonts: ./mpage-2.5.6/file.c0000644002342000234200000004571610312771075013341 0ustar marcelmarcel/* * file.c */ /* * mpage: a program to reduce pages of print so that several pages * of output appear on one printed page. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ #include "mpage.h" static int looks_utf8(FILE *fp); /* * do_file converts one file into postscript for output. The file type is * determined then the proper conversion routine is selected. */ void do_file(fname, asheet, outfd) char *fname; struct sheet *asheet; FILE *outfd; { FILE *fd; int in_type; /* * Open fname and try to figure out what type of file it is */ if ((fd = fopen(fname, "r")) == NULL) { fprintf(stderr, "%s: cannot open %s\n", MPAGE, fname); perror(MPAGE); return; } /* * if we have the pr option, then we have to assume it's a text file */ if (opt_pr || opt_input == IN_ASCII) in_type = IN_ASCII; else { /* * check for the cutomary characters that flag a postscript file */ if (ps_check(fd)) in_type = IN_PS; else in_type = IN_ASCII; } /* * For text input check if input is UTF-8 or not */ if (in_type == IN_ASCII && check_utf8 && looks_utf8 (fd)) use_utf8 = 1; (void) fclose(fd); if (opt_pr) { do_pr_file(fname, asheet, outfd); return; } /* * if not using pr(1), open fname and run th file trough the * specific processor. */ if ((fd = fopen(fname, "r")) == NULL) { fprintf(stderr, "%s: cannot open %s\n", MPAGE, fname); perror(MPAGE); return; } switch (in_type) { case IN_ASCII: do_text_doc(fd, asheet, outfd, fname); break; case IN_PS: do_ps_doc(fd, asheet, outfd, fname); break; /* Default figure out ourselfes */ } (void) fclose(fd); return; } /* do_file */ /* * do_pr_file processes one text file into postscript, but first runs the file * through pr(1). */ void do_pr_file(fname, asheet, outfd) char *fname; struct sheet *asheet; FILE *outfd; { FILE *fd; char command[LINESIZE]; /* * build the proper command based upon a specified * header or not */ #define DASHES "-- " if (opt_header != NULL) (void)sprintf(command, "%s -l%d -w%d -h \"%s\" %s%s", prprog, asheet->sh_plength, asheet->sh_cwidth, opt_header, fname[0] == '-' ? DASHES : "", fname); else (void)sprintf(command, "%s -l%d -w%d %s%s", prprog, asheet->sh_plength, asheet->sh_cwidth, fname[0] == '-' ? DASHES : "", fname); /* * open a pipe to the proper pr(1) command, and pr provides * us with the input */ if ((fd = popen(command, "r")) == NULL) { fprintf(stderr, "%s: cannot create pipe for '%s'\n", MPAGE, command); perror(MPAGE); } else { do_text_doc(fd, asheet, outfd, fname); (void)pclose(fd); } return; } /* do_pr_file */ /* * do_stdin uses do_????_doc to process the standard input */ void do_stdin(asheet, outfd) struct sheet *asheet; FILE *outfd; { #if 1 FILE *fd; char buffer[LINESIZE]; char tmpfile[LINESIZE]; int incnt, outcnt; int tmpfd; /* * Now the utf8 patch is in we always create a temporary file. * So now is the time to just create a temp file and continue * as if a filename was passed. This has some minor change * on the output pages as it does nit show anymore * but the tmpfilename */ (void) strcpy(tmpfile, "/tmp/mpage-stdin-XXXXXX"); if ( (tmpfd = mkstemp(tmpfile)) == -1) { fprintf(stderr, "%s: cannot create temporary file", MPAGE); perror(MPAGE); return; } close(tmpfd); if ((fd = fopen (tmpfile, "w")) == NULL) { fprintf(stderr, "%s: cannot reopen temporary file", MPAGE); perror(MPAGE); return; } do { incnt = fread(buffer, 1, sizeof buffer, stdin); outcnt = fwrite(buffer, 1, incnt, fd); } while (incnt && outcnt); (void) fclose(fd); do_file(tmpfile, asheet, outfd); (void) unlink(tmpfile); return; #else FILE *fd; char command[LINESIZE]; char tmpfile[LINESIZE]; char buffer[LINESIZE]; int incnt, outcnt; int tmpfd; if (opt_pr) { Debug(DB_STDIN, "%%do_stdin: pr option selects text\n", 0); /* * if pr(1) is to be used we need to read the input * and pass it to a pr(1) command which will write * a temporary file; this temporary file will then * be used as input to the do_doc routine */ (void)strcpy(tmpfile, "/tmp/mpageXXXXXX"); if ( (tmpfd = mkstemp(tmpfile)) == -1) { fprintf(stderr, "%s: cannot create temporary file", MPAGE); perror(MPAGE); return; } close(tmpfd); if (opt_header != NULL) (void)sprintf(command, "%s -l%d -w%d -h \"%s\" > %s", prprog, asheet->sh_plength, asheet->sh_cwidth, opt_header, tmpfile); else (void)sprintf(command, "%s -l%d -w%d > %s", prprog, asheet->sh_plength, asheet->sh_cwidth, tmpfile); /* * open a pipe to the pr(1) command which will create a * temporary file for convertin into PS */ if ((fd = popen(command, "w")) == NULL) { fprintf(stderr, "%s: cannot create pipe for '%s'\n", MPAGE, command); perror(MPAGE); return; } #ifdef DEBUG errno = 0; Debug(DB_STDIN, "%% sizeof buffer == %d\n", sizeof buffer); #endif /* * read input to mpage and pass it onto the pr(1) command */ do { incnt = fread(buffer, 1, sizeof buffer, stdin); outcnt = fwrite(buffer, 1, incnt, fd); Debug(DB_STDIN, "%% incnt == %d,", incnt); Debug(DB_STDIN, " outcnt == %d,", outcnt); Debug(DB_STDIN, " errno == %d\n", errno); } while (incnt && outcnt); Debug(DB_STDIN, "%% Done with while\n", 0); (void)pclose(fd); Debug(DB_STDIN, "%% closed pipe, looking for tmpfile\n", 0); /* * now open the temporary file and use do_doc to * convert it to PS */ if ((fd = fopen(tmpfile, "r")) == NULL) { fprintf(stderr, "%s: cannot open %s\n", MPAGE, tmpfile); perror(MPAGE); } else { /* * check if the input is UTF-8 or not */ if (looks_utf8 (fd)) use_utf8 = 1; Debug(DB_STDIN, "%% got tmpfile, now do_doc\n", 0); do_text_doc(fd, asheet, outfd, command); (void)fclose(fd); } /* * tidy up by removing our temp file */ Debug(DB_STDIN, "%% now remove '%s'\n", tmpfile); (void)unlink(tmpfile); } else { FILE *tfd; int dont_close = 0; /* * store the input to the temporary file to guess encoding correctly */ (void)strcpy(tmpfile, "/tmp/mpageXXXXXX"); if ( (tmpfd = mkstemp(tmpfile)) == -1) { fprintf(stderr, "%s: cannot create temporary file", MPAGE); tmpfile[0] = 0; } close(tmpfd); if (tmpfile[0] && (tfd = fopen (tmpfile, "w"))) { do { incnt = fread(buffer, 1, sizeof buffer, stdin); outcnt = fwrite(buffer, 1, incnt, tfd); } while (incnt && outcnt); fclose (tfd); if ((fd = fopen(tmpfile, "r")) == NULL) { fprintf(stderr, "%s: cannot open %s\n", MPAGE, tmpfile); perror(MPAGE); /* we should already read the input from stdin. * so probably it can't recovers */ return; } } else { /* try to use stdin */ fd = stdin; dont_close = 1; } /* * check that the input is whether UTF-8 or not. */ if (looks_utf8 (fd)) use_utf8 = 1; /* * check for the cutomary flag at the start of postscript files */ if (ps_check(fd)) { /* * found the flag signaling PS input */ Debug(DB_STDIN, "%%do_stdin: is postscript\n", 0); do_ps_doc(fd, asheet, outfd, "stdin"); } else { /* * no postscript flag, print the ascii text */ Debug(DB_STDIN, "%%do_stdin: not postscript\n", 0); do_text_doc(fd, asheet, outfd, "stdin"); } if (!dont_close) fclose (fd); /* remove the temporary file */ if (tmpfile[0]) (void)unlink(tmpfile); } return; #endif } /* do_stdin */ /* * iswanted () returns 1 if the specified page needs to be printed. * returns 0 if not. */ int iswanted(int sn) { int i; Debug(DB_STDIN, "%%iswanted: opt_jarg: %d\n", opt_jarg); Debug(DB_STDIN, "%%iswanted: sn: %d\n", sn); if (!opt_jarg) { Debug(DB_STDIN, "%%iswanted: wanted page %d\n", sn); ps_outpages++; return 1; } for (i = 0; i < opt_jarg; i++) { Debug(DB_STDIN, "%%iswanted: i: %d\n", i); Debug(DB_STDIN, "%%iswanted: opt_first[i]: %d\n", opt_first[i]); Debug(DB_STDIN, "%%iswanted: opt_alt[i]: %d\n", opt_alt[i]); Debug(DB_STDIN, "%%iswanted: opt_last[i]: %d\n", opt_last[i]); if ((sn >= opt_first[i] && (opt_alt[i] <= 1 || (sn - opt_first[i]) % opt_alt[i] == 0) ) && (sn <= opt_last[i])) { Debug(DB_STDIN, "%%iswanted: wanted page %d\n", sn); ps_outpages++; return 1; } } Debug(DB_STDIN, "%%iswanted: unwanted page %d\n", sn); return 0; } /* iswanted */ /* * do_sheets() is called from do_xxx_doc() to render the sheets; * it does sheet selection and reversal. */ void do_sheets(sheetfunc, inf, asheet, outf) int (*sheetfunc)(); FILE *inf; struct sheet *asheet; FILE *outf; { FILE *nullf = NULL; register int sheetno; int max_opt_last; max_opt_last = 0; for (sheetno = 0; sheetno < opt_jarg; sheetno++) if (max_opt_last < opt_last[sheetno]) max_opt_last = opt_last[sheetno]; if (max_opt_last == 0) max_opt_last = MAXINT; Debug(DB_STDIN, "%%do_sheets: max_opt_last: %d\n", max_opt_last); nullf = fopen("/dev/null", "w"); if (opt_reverse) { FILE *revf; long *pagebase; int pageroom; revf = tmpfile(); if (revf == NULL) { fprintf(stderr, "%s: can't create temporary file\n", MPAGE); exit(1); } pageroom = 50; pagebase = (long *)malloc(pageroom * sizeof(long)); if(pagebase == NULL) { fprintf(stderr, "%s: can't malloc 50 words\n", MPAGE); exit(1); } pagebase[0] = 0; for (sheetno = 1; sheetno <= max_opt_last; ) { if ((*sheetfunc)(inf, asheet, iswanted(sheetno) ? revf : nullf) == FILE_EOF) break; if (ferror(revf)) break; pagebase[sheetno++] = ftell(revf); if (sheetno >= pageroom) { pageroom *= 4; pagebase = (long *)realloc(pagebase, pageroom * sizeof(long)); if (pagebase == NULL) { fprintf(stderr, "%s: can't malloc %d words\n", MPAGE, pageroom); exit(1); } } } if (ferror(revf)) fprintf(stderr, "%s: error writing to temporary file\n", MPAGE); else { pagebase[sheetno] = ftell(revf); rewind(revf); while (--sheetno >= 0) { register int i, n; char buf[BUFSIZ]; fseek(revf, pagebase[sheetno], 0); for(i = pagebase[sheetno+1]-pagebase[sheetno]; i>0; i-=n) { n = i < BUFSIZ ? i : BUFSIZ; if (fread(buf, n, 1, revf) != 1) { fprintf(stderr, "%s: Premature EOF on temp file\n", MPAGE); break; } (void) fwrite(buf, n, 1, outf); } } } fclose(revf); free(pagebase); } else { /* Normal, non-reversed pages */ sheetno = 1; while (sheetno <= max_opt_last && (*sheetfunc)(inf, asheet, iswanted(sheetno) ? outf : nullf) != FILE_EOF) sheetno++; } if (nullf) fclose(nullf); return; } /* do_sheets */ /* * The below codes are privided for ascmagic.c in file-4.02. * looks_utf8() function are modified to handle the file handle directly. */ /* * This table reflects a particular philosophy about what constitutes * "text," and there is room for disagreement about it. * * Version 3.31 of the file command considered a file to be ASCII if * each of its characters was approved by either the isascii() or * isalpha() function. On most systems, this would mean that any * file consisting only of characters in the range 0x00 ... 0x7F * would be called ASCII text, but many systems might reasonably * consider some characters outside this range to be alphabetic, * so the file command would call such characters ASCII. It might * have been more accurate to call this "considered textual on the * local system" than "ASCII." * * It considered a file to be "International language text" if each * of its characters was either an ASCII printing character (according * to the real ASCII standard, not the above test), a character in * the range 0x80 ... 0xFF, or one of the following control characters: * backspace, tab, line feed, vertical tab, form feed, carriage return, * escape. No attempt was made to determine the language in which files * of this type were written. * * * The table below considers a file to be ASCII if all of its characters * are either ASCII printing characters (again, according to the X3.4 * standard, not isascii()) or any of the following controls: bell, * backspace, tab, line feed, form feed, carriage return, esc, nextline. * * I include bell because some programs (particularly shell scripts) * use it literally, even though it is rare in normal text. I exclude * vertical tab because it never seems to be used in real text. I also * include, with hesitation, the X3.64/ECMA-43 control nextline (0x85), * because that's what the dd EBCDIC->ASCII table maps the EBCDIC newline * character to. It might be more appropriate to include it in the 8859 * set instead of the ASCII set, but it's got to be included in *something* * we recognize or EBCDIC files aren't going to be considered textual. * Some old Unix source files use SO/SI (^N/^O) to shift between Greek * and Latin characters, so these should possibly be allowed. But they * make a real mess on VT100-style displays if they're not paired properly, * so we are probably better off not calling them text. * * A file is considered to be ISO-8859 text if its characters are all * either ASCII, according to the above definition, or printing characters * from the ISO-8859 8-bit extension, characters 0xA0 ... 0xFF. * * Finally, a file is considered to be international text from some other * character code if its characters are all either ISO-8859 (according to * the above definition) or characters in the range 0x80 ... 0x9F, which * ISO-8859 considers to be control characters but the IBM PC and Macintosh * consider to be printing characters. */ #define F 0 /* character never appears in text */ #define T 1 /* character appears in plain ASCII text */ #define I 2 /* character appears in ISO-8859 text */ #define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */ static char text_chars[256] = { /* BEL BS HT LF FF CR */ F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */ /* ESC */ F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */ /* NEL */ X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */ X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */ }; static int looks_utf8(FILE *fp) { long whence, nbytes; char *buf = NULL; int i, n; unsigned long c; int gotone = 0; /* memorize current position */ whence = ftell (fp); /* check the input size */ fseek (fp, 0L, SEEK_END); nbytes = ftell (fp) - whence; /* allocate memories */ buf = (char *) malloc (sizeof (char) * nbytes + 1); buf[nbytes] = 0; /* rewind the position */ fseek (fp, 0L, whence); /* read data */ fread (buf, sizeof (char), nbytes, fp); /* rewind the position again */ fseek (fp, 0L, whence); for (i = 0; i < nbytes; i++) { if ((buf[i] & 0x80) == 0) { /* 0xxxxxxx is plain ASCII */ /* * Even if the whole file is valid UTF-8 sequences, * still reject it if it uses weird control characters. */ if (text_chars[(int)buf[i]] != T) return 0; /* no need to store it * ubuf[(*ulen)++] = buf[i]; */ } else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */ return 0; } else { /* 11xxxxxx begins UTF-8 */ int following; if ((buf[i] & 0x20) == 0) { /* 110xxxxx */ c = buf[i] & 0x1f; following = 1; } else if ((buf[i] & 0x10) == 0) { /* 1110xxxx */ c = buf[i] & 0x0f; following = 2; } else if ((buf[i] & 0x08) == 0) { /* 11110xxx */ c = buf[i] & 0x07; following = 3; } else if ((buf[i] & 0x04) == 0) { /* 111110xx */ c = buf[i] & 0x03; following = 4; } else if ((buf[i] & 0x02) == 0) { /* 1111110x */ c = buf[i] & 0x01; following = 5; } else return 0; for (n = 0; n < following; n++) { i++; if (i >= nbytes) goto done; if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40)) return 0; c = (c << 6) + (buf[i] & 0x3f); } /* no need to store it * ubuf[(*ulen)++] = c; */ gotone = 1; } } done: if (buf) free (buf); return gotone; /* don't claim it's UTF-8 if it's all 7-bit */ } ./mpage-2.5.6/gencodes.c0000644002342000001440000000052306123335663014074 0ustar marcelusers#include main() { int i=0; printf(" 0 ["); putchar (i); for (i = 1; i < 256; i++) { if ((i / 16) * 16 == i) { putchar (']'); putchar ('\n'); printf("%3d [", i); } putchar (i); } putchar (']'); putchar ('\n'); exit(0); } /* main */ ./mpage-2.5.6/glob.c0000644002342000234200000004267310312766502013343 0ustar marcelmarcel/* * glob.c */ /* * mpage: a program to reduce pages of print so that several pages * of output appear on one printed page. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ #include "mpage.h" /* * to turn on debugging, define the preprocessor macro DEBUG and set * the variable Debug_flag to the sum of the sections to debug. */ # ifdef DEBUG int Debug_flag = DB_PSMPAGE; # endif /* * some basic PS parameters */ int ps_width; /* number of points in the X direction see set_page() */ int ps_height; /* number of points in the Y direction */ char *media; /* name of output media */ struct page_desc paper[] = { { "Letter", 612, 792 }, /* 8.5 x 11 in */ { "LetterSmall", 612, 792 }, { "Tabloid", 792, 1224 }, { "Ledger", 1224, 792 }, /* 8.5 x 14 in */ { "Legal", 612, 1008 }, { "Statement", 396, 612 }, { "Executive", 540, 720 }, { "A0", 2384, 3368 }, /* 840 x 1188 mm */ { "A1", 1684, 2384 }, /* 594 x 840 mm */ { "A2", 1192, 1684 }, /* 420 x 594 mm */ /* { "A3", 842, 1190 }, */ { "A3", 842, 1192 }, /* 297 x 420 mm */ /* ISO 216 conforming says 595x841 ... */ /* { "A4", 595, 842 }, */ { "A4", 596, 842 }, /* 210 x 297 mm */ { "A4Small", 595, 842 }, { "A5", 420, 595 }, { "B4", 729, 1032 }, { "B5", 516, 729 }, { "Folio", 612, 936 }, { "Quarto", 610, 780 }, { "10x14", 720, 1008 }, { (char *) NULL, 0, 0 } }; /* * the structures describe where to put the reduced pages of output on the * printed page. */ /* empty page */ struct pagepoints points_empty[] = { { 0, 0, 0 } }; /* base point for one page, normal aspect */ struct pagepoints one_normal[] = { { xbase1, ybase1, 0 }, { 0, 0, 0 } }; /* base points for two pages, normal aspect */ struct pagepoints two_normal[] = { { xbase1, ytop4, 0 }, { xbase1 , ytop2, 0 }, { 0, 0, 0 } }; /* GPN outside 2 pages */ struct pagepoints two_normal_co[] = { {xbase1, ytop2, 0}, {0, 0, SKIP_PS}, {0, 0, SKIP_PS}, {xbase1, ytop4, 0}, {0, 0, 0} }; /* GPN. inside 2 pages */ struct pagepoints two_normal_ci[] = { {0, 0, SKIP_PS}, {xbase1, ytop4, 0}, {xbase1, ytop2, 0}, {0, 0, SKIP_PS}, {0, 0, 0} }; /* GPN. all 4 pages */ struct pagepoints four_normal_dm[] = { {xbase1, ytop2, STORE_PS}, {xbase1, ytop4, 0}, {xbase1, ytop2, 0}, {0, 0, 0}, {xbase1, ytop4, FLUSH_PS}, {0, 0, 0} }; /* base points for four pages, normal aspect, running reduced pages * read from left to right */ struct pagepoints lr_four_normal[] = { { xbase1, ybase3, 0 }, { xbase2, ybase3, 0 }, { xbase1, ybase1, 0 }, { xbase2, ybase1, 0 }, { 0, 0, 0 } }; /* base points for four pages, normal aspect, running reduced pages * read from top to bottom (up/down) */ struct pagepoints ud_four_normal[] = { { xbase1, ybase3, 0 }, { xbase1, ybase1, 0 }, { xbase2, ybase3, 0 }, { xbase2, ybase1, 0 }, { 0, 0, 0 } }; /* base points for four pages, normal aspect, running reduced pages * read from left to right, adjusting for the fact that we have a landscape * input */ struct pagepoints land_lr_four_normal[] = { { xbase1, ybase1, 0 }, { xbase1, ybase3, 0 }, { xbase2, ybase1, 0 }, { xbase2, ybase3, 0 }, { 0, 0, 0} }; /* base points for four pages, normal aspect, running reduced pages * read from top to bottom (up/down), adjusting for the fact that we have a * landscape input */ struct pagepoints land_ud_four_normal[] = { { xbase1, ybase1, 0 }, { xbase2, ybase1, 0 }, { xbase1, ybase3, 0 }, { xbase2, ybase3, 0 }, { 0, 0, 0} }; /* base points for eight pages, normal aspect, running reduced pages * read from left to right */ struct pagepoints lr_eight_normal[] = { { xbase2, ytop4, 0 }, { xbase2, ytop3, 0 }, { xbase2, ytop2, 0 }, { xbase2, ytop1, 0 }, { xbase1, ytop4, 0 }, { xbase1, ytop3, 0 }, { xbase1, ytop2, 0 }, { xbase1, ytop1, 0 }, { 0, 0, 0 } }; /* base points for eight pages, normal aspect, running reduced pages * read from top to bottom (up/down) */ struct pagepoints ud_eight_normal[] = { { xbase2, ytop4, 0 }, { xbase1, ytop4, 0 }, { xbase2, ytop3, 0 }, { xbase1, ytop3, 0 }, { xbase2, ytop2, 0 }, { xbase1, ytop2, 0 }, { xbase2, ytop1, 0 }, { xbase1, ytop1, 0 }, { 0, 0, 0 } }; /* base points for eight pages, normal aspect, running reduced pages * read from left to right, adjusting for the fact that we have a landscape * input */ struct pagepoints land_lr_eight_normal[] = { { xbase1, ytop4, 0 }, { xbase2, ytop4, 0 }, { xbase1, ytop3, 0 }, { xbase2, ytop3, 0 }, { xbase1, ytop2, 0 }, { xbase2, ytop2, 0 }, { xbase1, ytop1, 0 }, { xbase2, ytop1, 0 }, { 0, 0, 0 } }; /* base points for eight pages, normal aspect, running reduced pages * read from top to bottom (up/down), adjusting for the fact that we have a * landscape input */ struct pagepoints land_ud_eight_normal[] = { { xbase1, ytop4, 0 }, { xbase1, ytop3, 0 }, { xbase1, ytop2, 0 }, { xbase1, ytop1, 0 }, { xbase2, ytop4, 0 }, { xbase2, ytop3, 0 }, { xbase2, ytop2, 0 }, { xbase2, ytop1, 0 }, { 0, 0, 0} }; /* base point for one page, in landscape */ struct pagepoints one_landscape[] = { { xbase1, ytop4, 0 }, { 0, 0, 0 } }; /* base points for two pages, in landscape */ struct pagepoints two_landscape[] = { { xbase1, ybase3, 0 }, { xbase1, ybase1, 0 }, { 0, 0, 0 } }; /* base points for four pages, in landscape, running reduced pages * read from left to right */ struct pagepoints lr_four_landscape[] = { { xbase2, ytop4, 0 }, { xbase2, ytop2, 0 }, { xbase1, ytop4, 0 }, { xbase1, ytop2, 0 }, { 0, 0, 0 } }; /* base points for four pages, in landscape, running reduced pages * read from top to bottom (up/down) */ struct pagepoints ud_four_landscape[] = { { xbase2, ytop4, 0 }, { xbase1, ytop4, 0 }, { xbase2, ytop2, 0 }, { xbase1, ytop2, 0 }, { 0, 0, 0 } }; /* base points for eight pages, in landscape, running reduced pages * read from left to right */ struct pagepoints lr_eight_landscape[] = { { xbase1, ybase4, 0 }, { xbase2, ybase4, 0 }, { xbase1, ybase3, 0 }, { xbase2, ybase3, 0 }, { xbase1, ybase2, 0 }, { xbase2, ybase2, 0 }, { xbase1, ybase1, 0 }, { xbase2, ybase1, 0 }, { 0, 0, 0 } }; /* base points for eight pages, in landscape, running reduced pages * read from top to bottom (up/down) */ struct pagepoints ud_eight_landscape[] = { { xbase1, ybase4, 0 }, { xbase1, ybase3, 0 }, { xbase1, ybase2, 0 }, { xbase1, ybase1, 0 }, { xbase2, ybase4, 0 }, { xbase2, ybase3, 0 }, { xbase2, ybase2, 0 }, { xbase2, ybase1, 0 }, { 0, 0, 0 } }; /* list of sheets (printed page formats) for * left to right reading, in normal aspect */ struct sheet lr_normal[] = { /* 0 */ { 80, 66, xwid1, yht1, 0, outline_1, one_normal }, /* 1 */ { 80, 66, yht2, xwid1, -90, outline_2, two_normal }, /* 2 */ { 80, 66, xwid2, yht2, 0, outline_4, lr_four_normal }, /* 3 */ { 80, 66, yht4, xwid2, -90, outline_8, lr_eight_normal }, }; /* list of sheets (printed page formats) for landscape input * left to right reading, in normal aspect */ struct sheet land_lr_normal[] = { /* 0 */ { 80, 66, xwid1, yht1, 0, outline_1, one_normal }, /* 1 */ { 80, 66, yht2, xwid1, -90, outline_2, two_normal }, /* 2 */ { 80, 66, xwid2, yht2, 0, outline_4, land_lr_four_normal }, /* 3 */ { 80, 66, yht4, xwid2, -90, outline_8, land_lr_eight_normal }, }; /* list of sheets (printed page formats) for * top to bottom reading, in normal aspect */ struct sheet ud_normal[] = { /* 0 */ { 80, 66, xwid1, yht1, 0, outline_1, one_normal }, /* 1 */ { 80, 66, yht2, xwid1, -90, outline_2, two_normal }, /* 2 */ { 80, 66, xwid2, yht2, 0, outline_4, ud_four_normal }, /* 3 */ { 80, 66, yht4, xwid2, -90, outline_8, ud_eight_normal }, }; /* list of sheets (printed page formats) for * left to right reading, in landscape */ struct sheet lr_landscape[] = { /* 0 */ { 132, 52, yht1, xwid1, -90, outline_1, one_landscape }, /* 1 */ { 132, 52, xwid1, yht2, 0, outline_2, two_landscape }, /* 2 */ { 132, 52, yht2, xwid2, -90, outline_4, lr_four_landscape }, /* 3 */ { 132, 52, xwid2, yht4, 0, outline_8, lr_eight_landscape }, }; /* list of sheets (printed page formats) for * top to bottom reading, in landscape */ struct sheet ud_landscape[] = { /* 0 */ { 132, 52, yht1, xwid1, -90, outline_1, one_landscape }, /* 1 */ { 132, 52, xwid1, yht2, 0, outline_2, two_landscape }, /* 2 */ { 132, 52, yht2, xwid2, -90, outline_4, ud_four_landscape }, /* 3 */ { 132, 52, xwid2, yht4, 0, outline_8, ud_eight_landscape }, }; /* list of sheets (printed page formats) for landscape input * top to bottom reading, in landscape */ struct sheet land_ud_normal[] = { /* 0 */ { 80, 66, xwid1, yht1, 0, outline_1, one_normal }, /* 1 */ { 80, 66, yht2, xwid1, -90, outline_2, two_normal }, /* 2 */ { 80, 66, xwid2, yht2, 0, outline_4, land_ud_four_normal }, /* 3 */ { 80, 66, yht4, xwid2, -90, outline_8, land_ud_eight_normal }, }; /* GPN. sheet */ struct sheet coli [] = { /* 1 */ { 80, 66, yht2, xwid1, -90, outline_2, two_normal_co }, /* 2 */ { 80, 66, yht2, xwid1, -90, outline_2, two_normal_ci }, /* 3 */ { 80, 66, yht2, xwid1, -90, outline_2, four_normal_dm }, }; /* array of sheet lists for left to right reading printed pages */ struct sheet *left_right[] = { lr_normal, lr_landscape, land_lr_normal }; /* arrays for top to bottom reading printed pages */ struct sheet *up_down[] = { ud_normal, ud_landscape, land_ud_normal }; /* * Variables for holding the chosen options, The defaults are set here. * the sheetlist pointer is set to point to the array for either up/down * or left/right reading. This array is index by sheetorder, and then * sheetindex. sheetindex encodes the number of reduced pages per printed * page and indexes into the sheet list (0 = 1 page, 1 = two pages, 2 = * four pages, 3 = eight pages). */ struct sheet **sheetlist;/* array of sheet lists (up/down or left/right) */ int sheetaspect = PORTRAIT; /* either normal or landscape */ int sheetorder = UPDOWN; /* up/down or left/right flag */ int sheetindex = 2; /* index to page descriptor array */ int sheetmargin_left = DEFAULTSMARGIN; /* non-printable border on sheet */ int sheetmargin_right = DEFAULTSMARGIN; /* non-printable border on sheet */ int sheetmargin_top = DEFAULTSMARGIN; /* non-printable border on sheet */ int sheetmargin_bottom= DEFAULTSMARGIN; /* non-printable border on sheet */ int pagemargin_left = DEFAULTPMARGIN; /* border for pages */ int pagemargin_right = DEFAULTPMARGIN; /* border for pages */ int pagemargin_top = DEFAULTPMARGIN; /* border for pages */ int pagemargin_bottom = DEFAULTPMARGIN; /* border for pages */ int textmargin_left = DEFAULTTMARGIN; /* border for textbox */ int textmargin_right = DEFAULTTMARGIN; /* border for textbox */ int textmargin_top = DEFAULTTMARGIN; /* border for textbox */ int textmargin_bottom = DEFAULTTMARGIN; /* border for textbox */ int sheetheader_left = 0; /* space for physical sheetheader */ int sheetheader_right = 0; /* space for physical sheetheader */ int sheetheader_top = 0; /* space for physical sheetheader */ int sheetheader_bottom= 0; /* space for physical sheetheader */ struct pagepoints *points = points_empty; int orientation; /* final orientation of text */ int fsize = TSIZE; /* font scale size */ int opt_indent = 0; /* starting column for ascii printing */ int opt_tabstop = DEFAULTTABSTOP; /* width of a tab */ int opt_lines = 0; /* lines to fit on reduced page */ int opt_killtrail = 1; /* Quit reading input on %%TRailer */ int opt_width = 0; /* columns to fit on reduced page */ char * opt_page = PAGE_DEF; /* default paper size */ /* boolean's: set default to 0 or 1 */ int opt_pr = 0; /* if true use pr(1) to format output */ int opt_mp_header = 0; /* let mpage create headers */ int opt_sheetheader = 0; /* let mpage create sheetheaders */ int opt_fold = 0; /* fold lines longer than page width */ int opt_outline = 1; /* don't normally outline the pages */ int opt_verbose = 0; /* print a count of pages produced */ int opt_square = 1; /* print pages with natural aspect ratio */ int opt_reverse = 0; /* by default print sheets in forward order */ int opt_jarg = 0; /* number of -j opt sets */ int opt_first[MAXJARG]; /* start with first sheet per -j */ int opt_last[MAXJARG]; /* print as many as supplied per -j */ int opt_alt[MAXJARG]; /* by default print all sheets, odd+even per -j*/ int opt_file = 1; /* should each file appera on a new sheet */ int opt_duplex = DEFAULT_DUPLEX; /* duplex mode flag */ int opt_tumble = 0; /* tumble overy second pages */ int opt_textbox = 0; /* don't normally draw box around text */ int opt_input = IN_AUTO; /* select input file format */ int opt_encoding = DEFAULT_ENCODING; /* use default encoding or not */ struct pagebox textbox = {0, 0, 80, 66, 0}; char * opt_header = NULL; /* the header for pr's -h option */ char * printque = NULL; /* the printer queuename */ char * prprog = PRPROG; /* the pr filter program */ char * printprog = PRINTPROG; /* the print program */ char * printarg = QUEARG; /* define print queue to printprog */ int doprint = 0; /* send it to the printer */ char * charvec_file; /* file to read character definitions from */ char * libdir = LIBDIR; /* pointer to get library files from */ char * fontname = "Courier"; /* Font to use */ char * dateformat = "%c"; /* Date/time format for date in headers */ char * sheethead = ""; /* Leave empty to get default sheetheader: current filename + physical pagenumber */ /* * various global information */ char MPAGE[] = "mpage"; /* program name */ int ps_pagenum = 0; /* current sheet count (printed or not) */ int ps_outpages= 0; /* sheets printed */ int had_ps = 0; /* did we process ps files */ int first_encoding = -1; /* first encoding in character set */ int last_encoding; /* last encoding in character set */ /* GPN. for coli */ int Coli = 0; /* value of 0 = don't mess, 1 = 4, 1 (outside pages)*/ int use_utf8 = 0; /* is input UTF-8 or not. */ int check_utf8 = 1; /* do we want to check for UTF-8 or not. */ void usage(int errcode) { fprintf(stderr, "\ mpage - print multiple pages on postscript, version %s\n\n\ mpage [-1248aceEfHlkoOrRStTvuVxX] [-b papersize] [-Btextboxmargin]\n\ [-C [encodingfile]] [-da|p] [-D dateformat] [-F fontname]\n\ [-h header] [-I indent] [-j pagespec] [-J startpageno] [-L lines]\n\ [-msheetmargin] [-Mpagemargin] [-p[prprog]] [-P[printer]]\n\ [-s tabstop] [-W width] [-X [header]] [-z printcmd] [-Z quearg]\n\ [file...]]\n", VERSION ); fprintf(stderr, "\n\ -1, -2, -4, -8 Pages per sheet (4) -D strftime format for date specs\n\ -da Force ascii input format -dp Force postscript input format\n\ -a Toggle across/updown layout (u) -l Toggle portrait/landscape (p)\n\ -f Toggle folding long lines (off) -o Toggle printing outlines (on)\n\ -r Reverse printing, last->first sheet -v Toggle verbose output, (on)\n\ -F Text font to be used (%s) -C Character encoding filename\n\ -E Print every second and third page -O Print every first and fourth page\n\ -s Define tabstop width (%d) -k kill on %%TRailer is PS file\n\ -V Show mpage version.\n -u switch of utf-8 check\n\ -b papersize (%s), use l or ? to get a list of sizes\n\ -R Switch to across mode, with first page at lower left corner\n\ -H Create page header for each page for text files\n\ -X Print physical page header (filename + physical pagenumber)\n\ -c Toggle concat pages of different files on same sheet (off)\n\ -S Don't square pages for PS input (default uniform X/Y shrink)\n\ -B Specify textbox margin/thickness (no space): [[lrtb]*]*\n\ -m Specify sheetmargin (no space): [[lrtb]*]*\n\ -M Specify pagemargins (no space): [[lrtb]*]*\n\ -p Pipe through prprog (no space), pr(1) is default.\n\ Mpage assumes the specified pr understands -l, -w and -h options.\n\ -P Specify printer queue (no space). -P only uses default queue.\n\ -z Specify print command (%s).\n\ -Z Specify print command print queue option (%s).\n\ -j Print specified sheets: first[-last][%%interval]\n\ -j 1-10 does first 10 sheets, -j 1%%2 prints odd ones, -j 2%%2 even ones.\n\ -J Set the start of the sheet page count\n\ -t Toggle printing both sides of the paper (Duplex mode, %s)\n\ -T Toggle tumble of every second pages when printing in duplex mode (off)\n", fontname, opt_tabstop, PAGE_DEF, printprog, printarg, opt_duplex ? "on" : "off" ); fprintf(stderr, "\n(c) 1993-2005 Marcel Mol, marcel@mesa.nl (MESA Consulting)\n"); return; } /* usage */ ./mpage-2.5.6/mpage.c0000644002342000234200000002770210741123053013477 0ustar marcelmarcel/* * mpage.c */ /* * mpage: a program to reduce pages of print so that several pages * of output appear on one printed page. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ #include "mpage.h" #include #include #include #include #include "encoding.h" /* * Function Declarations */ static void ps_title(); char *current_locale; int main(argc, argv) int argc; char **argv; { FILE *outfd; int currarg; struct sheet *thelist; struct sheet *thesheet; char outcommand[LINESIZE]; /* the command which is the output filter */ current_locale = setlocale(LC_ALL,""); #ifdef __EMX__ /* * wildcard expansion from emx package (used by OS/2) */ _wildcard (&argc, &argv); #endif /* * Check page size for /etc/papersize */ check_papersize(); /* * examine the environment for PRINTER (or LPDEST) and MPAGE * environment variables */ if ((currarg = do_env()) < 0) { usage(currarg); exit(1); } if ((currarg = do_args(argc, argv, 0)) < 0) { usage(currarg); exit(1); } /* * if a print queue was specified then create a print command using * the queue, else use standard output. */ if (doprint) { if (printque != NULL) (void) sprintf(outcommand, "%s %s%s", printprog, printarg, printque); else (void) strcpy(outcommand, printprog); if ((outfd = popen(outcommand, "w")) == NULL) { fprintf(stderr, "%s: cannot create pipe for '%s'\n", MPAGE, outcommand); perror(MPAGE); } } else outfd = stdout; /* * pick the array of sheet lists based upon the specified option */ if (sheetorder == UPDOWN) sheetlist = up_down; else sheetlist = left_right; /* * from the array of sheet lists pick the proper sheet list for * the given sheetaspect, then select the proper sheet format * for the given number of redueced pages per output page */ thelist = sheetlist[sheetaspect]; thesheet = &(thelist[sheetindex]); /* GPN. */ if (Coli == 1) thesheet = &(coli[0]); if (Coli == 2) thesheet = &(coli[1]); if (Coli == 3) thesheet = &(coli[2]); orientation = (sheetindex + sheetaspect) & 0x01; /* * if either lines or columns were specified as options, over * the default sheets idea of the number of line or columns * per reduced page */ if (opt_lines > 0) thesheet->sh_plength = opt_lines; if (opt_width > 0) thesheet->sh_cwidth = opt_width; /* * Prepare the textbox parameters when needed */ if (opt_textbox) { textbox.over = textmargin_left; textbox.lift = textmargin_bottom; textbox.wide = thesheet->sh_cwidth - (textmargin_left+textmargin_right); textbox.high = thesheet->sh_plength - (textmargin_top+textmargin_bottom); } /* * if there are arguments left over after processing options, then * these are names of files to process, else process the standard * input */ if (currarg < argc) { ps_title(argv[currarg], outfd); for ( ; currarg < argc; currarg++) do_file(argv[currarg], thesheet, outfd); } else { ps_title("", outfd); do_stdin(thesheet, outfd); } /* * in case files are merged on sheets, make sure the last page * is printed... */ if (points->pp_origin_x != 0 && !opt_file) { if (had_ps) fprintf(outfd, "showsheet\n"); else { fprintf(outfd, "restore\n"); fprintf(outfd, "showpage\n"); } } /* * having processed all input, print out a PS trailer * (timing stuff stolen from old adobe troff stuff) */ fprintf(outfd, "%%%%Trailer\n"); if (opt_verbose) { fprintf(outfd, "statusdict begin jobname print flush"); fprintf(outfd, " (: Job finished:\\n) print\n"); fprintf(outfd, "(\\tmpage time (s) = ) print flush usertime "); fprintf(outfd, "mp_stm sub 1000 div ==\n(\\tmpage pages = ) print"); fprintf(outfd, " flush pagecount mp_pgc sub ==\nend flush\n"); /* fprintf(outfd, "showpage\n"); */ } fprintf(outfd, "%%%%Pages: %d\n", ps_outpages); if (opt_verbose) { fprintf(stderr, "[%s: %d pages, ", MPAGE, ps_outpages); if (doprint) { if (printque != NULL) fprintf(stderr, "print queue %s]\n", printque); else fprintf(stderr, "on default printer queue]\n"); } else fprintf(stderr, "on ]\n"); } /* * proper clean up to make sure the pipe is flushed */ if (doprint) (void) pclose(outfd); return 0; } /* main */ /* * ps_title prints a post script header suitable for PS processors */ static void ps_title(name, outfd) char *name; FILE *outfd; { time_t curr_time; char *time_str; FILE * charfp; char buf[LINESIZE]; fprintf(outfd, "%%!PS-Adobe-2.0\n"); fprintf(outfd, "%%%%DocumentFonts: %s Times-Bold\n", fontname); fprintf(outfd, "%%%%Title: %s (%s)\n", name, MPAGE); fprintf(outfd, "%%%%Creator: %s %s\n", MPAGE, VERSION); (void) time(&curr_time); time_str = ctime(&curr_time); fprintf(outfd, "%%%%CreationDate: %s", time_str); fprintf(outfd, "%%%%Orientation: %s\n", orientation ? "Landscape" : "Portrait"); fprintf(outfd, "%%%%DocumentMedia: %s %d %d\n", media, ps_width, ps_height); fprintf(outfd, "%%%%BoundingBox: %d %d %d %d\n", sheetmargin_left, sheetmargin_bottom, ps_width - sheetmargin_right, ps_height - sheetmargin_top); fprintf(outfd, "%%%%Pages: (atend)\n"); fprintf(outfd, "%%%%EndComments\n\n"); fprintf(outfd, "%%%%BeginProlog\n\n"); fprintf(outfd, "/mp_stm usertime def\n"); fprintf(outfd, "/mp_pgc statusdict begin pagecount end def\n"); fprintf(outfd, "statusdict begin /jobname (%s) def end\n", name); if (opt_duplex) { fprintf(outfd, "statusdict /setduplexmode known"); fprintf(outfd, " { statusdict begin true setduplexmode end } if\n"); if (opt_tumble) { fprintf(outfd, "statusdict /settumble known "); fprintf(outfd, "{ statusdict begin true settumble end } if\n"); } } else { /* * CAN WE DO THIS FOR PRINTERS THAT DO NOT NDERSTAND DUPLEX PRINTING??? * It also seems to break for example the lp -o duplex command. * So better switch this part of. */ #if 0 fprintf(outfd, "statusdict /setduplexmode known"); fprintf(outfd, " { statusdict begin false setduplexmode end } if\n"); #endif } if (opt_encoding) { fprintf(outfd, "/reencsmalldict 12 dict def " "/ReEncodeSmall { reencsmalldict begin\n" "/newcodesandnames exch def " "/newfontname exch def " "/basefontname exch def\n" "/basefontdict basefontname findfont def " "/newfont basefontdict maxlength dict def\n" "basefontdict " "{ exch dup /FID ne " "{ dup /Encoding eq " "{ exch dup length array copy newfont 3 1 roll put } " "{ exch newfont 3 1 roll put }\n" "ifelse }\n" " { pop pop }\n" " ifelse } " "forall\n" "newfont /FontName newfontname put\n" "newcodesandnames aload pop " "newcodesandnames length 2 idiv\n" "{ newfont /Encoding get 3 1 roll put } " "repeat\n" "newfontname newfont definefont pop " "end } def\n"); fprintf(outfd, "/charvec [\n"); if (charvec_file != NULL) { if ((charfp = fopen(charvec_file, "r")) == NULL) { perror(charvec_file); exit(1); } while (fgets(buf, LINESIZE, charfp) != NULL) { if (*buf != '%' && *buf != '\n') { if (first_encoding == -1) { first_encoding = atoi(buf); last_encoding = atoi(strchr(buf, ' ')); # ifdef DEBUG fprintf(stderr, "first=%d, last=%d\n", first_encoding, last_encoding); #endif } else fprintf(outfd, "%s", buf); } } } else { /* use internal default encoding */ int i; first_encoding = encoding_table_first; last_encoding = encoding_table_last; for (i = 0; i <= last_encoding - first_encoding; i++) fprintf(outfd, "%s\n", encoding_table[i]); } fprintf(outfd, "] def\n"); fprintf(outfd, "/%s /OurCharSet charvec ReEncodeSmall\n", fontname); } else { first_encoding = ' '; last_encoding = '~'; } fprintf(outfd, "/textfont /%s findfont %d scalefont def\n", opt_encoding ? "OurCharSet" : fontname, fsize - 1); fprintf(outfd, "/textfontbold /%s-Bold findfont %d scalefont def\n", opt_encoding ? "OurCharSet" : fontname, fsize - 1); fprintf(outfd, "/fnamefont /Times-Bold findfont %d scalefont def\n", HSIZE); fprintf(outfd, "/headerfont /Times-Bold findfont %d scalefont def\n", HSIZE - 2); fprintf(outfd, "textfont setfont\n"); fprintf(outfd, "(a) stringwidth pop /mp_a_x exch def\n"); if (current_locale){ if (!strncmp (current_locale, "ja_JP", 5)){ #ifdef KANJI #ifdef GOTHIC fprintf(outfd, "/kanj /GothicBBB-Medium-H findfont %d scalefont def\n", fsize - 1); fprintf(outfd, "/han /GothicBBB-Medium.Hankaku findfont %d scalefont def\n", fsize - 1); #else fprintf(outfd, "/kanj /Ryumin-Light-H findfont %d scalefont def\n", fsize - 1); fprintf(outfd, "/han /Ryumin-Light.Hankaku findfont %d scalefont def\n", fsize - 1); #endif #endif #ifdef GOTHIC fprintf(outfd, "/unijis /GothicBBB-Medium-UniJIS-UTF8-H findfont %d scalefont def\n", fsize - 1); #else fprintf(outfd, "/unijis /Ryumin-Light-UniJIS-UTF8-H findfont %d scalefont def\n", fsize - 1); #endif } else if (!strncmp (current_locale, "ko_KR", 5)) fprintf(outfd, "/uniks /Baekmuk-Batang-UniKS-UTF8-H findfont %d scalefont def\n", fsize - 1); else if (!strncmp (current_locale, "zh_CN", 5)) fprintf(outfd, "/unigb /BousungEG-Light-GB-UniGB-UTF8-H findfont %d scalefont def\n", fsize - 1); else if (!strncmp (current_locale, "zh_TW", 5)) fprintf(outfd, "/unicns /ShanHeiSun-Light-UniCNS-UTF8-H findfont %d scalefont def\n", fsize - 1); } # ifdef DEBUG if (Debug_flag & DB_PSMPAGE) fprintf(outfd, "(\\t'a' length ) print mp_a_x ==\nflush\n"); # endif fprintf(outfd, "%%%%EndProlog\n"); if (opt_duplex) { fprintf(outfd, "%%%%BeginSetup\n"); if (opt_tumble) { fprintf(outfd, "%%%%BeginFeature: *Duplex DuplexTumble\n"); fprintf(outfd, "<< /Duplex true /Tumble true >> setpagedevice\n"); fprintf(outfd, "%%%%EndFeature\n"); } else { fprintf(outfd, "%%%%BeginFeature: *Duplex DuplexNoTumble\n"); fprintf(outfd, "<< /Duplex true /Tumble false >> setpagedevice\n"); fprintf(outfd, "%%%%EndFeature\n"); } fprintf(outfd, "%%%%EndSetup\n"); } return; } /* ps_title */ ./mpage-2.5.6/mpage.h0000644002342000234200000002521310742655416013515 0ustar marcelmarcel/* * mpage.h */ /* * mpage: A program to reduce pages of print so that several pages * of output appear on one sheet of paper. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ /* * Through-out the program comments I have tried to refer to pages a the * logical printed page of text that gets reduced. Sheets refer to physical * pieces of paper. Hence, mulitple pages appear on a sheet. "page" is a * logical or virtual entity, and "sheet" is physical entity. */ #include #include #include #include #include #define VERSION "2.5.6 Januari 2008" #define TRUE 1 #define FALSE 0 #define LINESIZE 1024 #define FILE_CONT 0 #define FILE_EOF 1 #define FILE_MORE 2 #define LINE_MORE 5 #define LINE_EOF_NOW 4 #define LINE_EOF 3 #define LINE_OVERPRINT 2 #define LINE_BLANK 1 #define SKIP_PS 1 #define STORE_PS 2 #define FLUSH_PS 3 #define TSIZE 12 #define HSIZE TSIZE+2 #define DEFAULTPMARGIN 4 #if !defined(DEFAULTSMARGIN) # define DEFAULTSMARGIN 20 #endif #define DEFAULTTMARGIN 0 #define DEFAULTTABSTOP 8 #if !defined(MAXINT) # ifdef INT_MAX # define MAXINT INT_MAX # else # define MAXINT (1 << 30) # endif #endif #if !defined(DEFAULT_ENCODING) # define DEFAULT_ENCODING 0 #endif #define MAXJARG 100 /* * to turn on debugging, define the preprocessor macro DEBUG and set * the variable Debug_flag to the sum of the sections to debug. */ # ifdef DEBUG # define Debug(f,s,a) if (Debug_flag & f) printf(s,a) # define DB_GETLINE 0x0000001 # define DB_ONEPAGE 0x0000002 # define DB_STDIN 0x0000004 # define DB_PSDOC 0x0000008 # define DB_PSPAGE 0x0000010 # define DB_PSCHECK 0x0000020 # define DB_PSROFF 0x0000040 # define DB_PSMPAGE 0x0000080 # define DB_POINTS 0x0000100 # define DB_POST 0x0000200 # define DB_UNUSED 0x0000400 extern int Debug_flag; extern int errno; # else # define Debug(f,s,a) # endif /* DEBUG */ /* * definitions for sorting out types of postscript input */ # define PS_NONE 0 # define PS_PSROFF 1 # define PS_MPAGE 2 # define PS_CONFORM 3 # define PS_OTHER 4 # define PS_MSWINDOWS 5 # define PS_TEX 6 # define PS_TEX2 7 /* * Input file type selection types */ # define IN_AUTO 0 # define IN_ASCII 1 # define IN_PS 2 /* * set default page size */ #if !defined(PAGE_DEF) # define PAGE_DEF "A4" #endif /* * define print spooler types */ #define ATT_SPOOLER 1 #define BSD_SPOOLER 2 #if !defined(SPOOLER) # define SPOOLER BSD_SPOOLER #endif /* * printing definitions */ #if !defined(PRPROG) # define PRPROG "pr" #endif #if !defined(PRINTPROG) # if SPOOLER == ATT_SPOOLER # define PRINTPROG "lp" # else /* BSD_SPOOLER */ # define PRINTPROG "lpr" # endif #endif #if !defined(QUEARG) # if SPOOLER == ATT_SPOOLER # define QUEARG "-d" # else /* BSD_SPOOLER */ # define QUEARG "-P" # endif #endif /* * "Conforming" postscript flag string (remember ps_check strips * the "%!" flag from PS files */ # define PS_FLAG "PS" # define PS_FLAG2 "-Adobe-" /* * a sheet describes the measurements and orientatation of a page for * use in constructing a sheet preabmles. */ struct sheet { int sh_cwidth; /* number of characters across a page */ int sh_plength; /* number of lines down a page */ int (*sh_width)(); /* postscript width across a printed page */ int (*sh_height)(); /* postscript height of a printed page */ int sh_rotate; /* angle to rotate the page */ void (*sh_outline)(); /* text to print as outline for */ /* the printed sheet*/ struct pagepoints *sh_pagepoints; /* where to put pages on */ /* the printed sheet */ }; /* * simple x and y coordinates for putting pages of output on printed sheet * skip to skip this page??? */ struct pagepoints { int (*pp_origin_x)(); int (*pp_origin_y)(); int skip; }; /* * Definition of an optional annotate box around part of text */ struct pagebox { int over; /* over from the left column */ int lift; /* lift from the bottom line */ int wide; /* columns wide */ int high; /* lines high */ int thick;/* line thickness */ }; /* * Structure to describe a physical piece of paper, e.g. A4 or Letter */ struct page_desc { char *media; int width; int height; }; /* * some basic PS parameters */ extern int ps_width; /* number of points in the X direction (8.5 inches) */ extern int ps_height; /* number of points in the Y direction (11 inches) */ extern char * media; /* name of output page media */ extern struct page_desc paper[]; /* array of sheets where pages are ordered for coli ??? */ extern struct sheet coli[]; /* array of sheets where pages are ordered for left to right reading */ extern struct sheet *left_right[]; /* arrays for sheets where pages are ordered for top to bottom reading */ extern struct sheet *up_down[]; /* definitions for aspect and reading directions */ # define PORTRAIT 0 # define LANDSCAPE 1 # define LANDSCAPE_PORTRAIT 2 # define UPDOWN 0 # define LEFTRIGHT 1 /* * Variables for holding the chosen options, The defaults are set here. * the sheetlist pointer is set to point to the array for either up/down * or left/right reading. This array is index by sheetorder, and then * sheetindex. sheetindex encodes the number of reduced pages per printed * sheet and indexes into the sheet list (0 = 1 page, 1 = two pages, 2 = * four pages, 3 = eight pages). */ extern struct sheet **sheetlist;/* array of sheet lists (up/down or left/right) */ extern int sheetaspect; /* either normal or landscape */ extern int sheetorder; /* up/down or left/right flag */ extern int sheetindex; /* index to number of pages of sheet */ extern int sheetmargin_left; /* non-printable border on sheet */ extern int sheetmargin_right; /* non-printable border on sheet */ extern int sheetmargin_top; /* non-printable border on sheet */ extern int sheetmargin_bottom; /* non-printable border on sheet */ extern int pagemargin_left; /* border for pages */ extern int pagemargin_right; /* border for pages */ extern int pagemargin_top; /* border for pages */ extern int pagemargin_bottom; /* border for pages */ extern int textmargin_left; /* border for textbox */ extern int textmargin_right; /* border for textbox */ extern int textmargin_top; /* border for textbox */ extern int textmargin_bottom; /* border for textbox */ extern int sheetheader_left; /* space for physical sheetheader */ extern int sheetheader_right; /* space for physical sheetheader */ extern int sheetheader_top; /* space for physical sheetheader */ extern int sheetheader_bottom; /* space for physical sheetheader */ extern struct pagepoints *points; extern int orientation; /* final orientation of text */ extern int fsize; /* font scale size */ extern int opt_pr; /* boolean, if true use pr to format output */ extern int opt_tabstop; /* define tabstop width */ extern int opt_indent; /* starting column for text printing */ extern int opt_lines; /* number of lines to fit on an reduced page */ extern int opt_killtrail; /* stop reading input on %%TRailer */ extern int opt_width; /* number of columns to fit on reduced page */ extern int opt_mp_header; /* let mpage create a header */ extern int opt_sheetheader; /* let mpage create sheetheaders */ extern char * opt_page; /* sheets size: a4 or us letter */ extern int opt_fold; /* fold long lines */ extern int opt_outline; /* print a nice outline around pages */ extern int opt_verbose; /* print a count of pages sent to printer */ extern int opt_square; /* Make pages with same aspect as sheets */ extern int opt_reverse; /* Print sheets in reverse order */ extern int opt_jarg; /* Number of -j arg sets */ extern int opt_first[MAXJARG]; /* First sheet # to print, 1 = first */ extern int opt_last[MAXJARG]; /* Last sheet # to print, 0 = EOF */ extern int opt_alt[MAXJARG]; /* Print every Nth sheet */ extern int opt_file; /* should each file appera on a new sheet */ extern int opt_duplex; /* duplex mode*/ extern int opt_tumble; /* tumble every second pages */ extern int opt_textbox; /* print a nice box box around text*/ extern int opt_input; /* set input file type */ extern int opt_encoding; /* use default encoding or not */ extern struct pagebox textbox; extern char * opt_header; /* the header for pr's -h option */ extern char * printque; /* the printer queuename */ extern char * prprog; /* the pr filter program */ extern char * printprog; /* the print program */ extern char * printarg; /* define print queue to printprog */ extern int doprint; /* send output to printer or not */ extern char * charvec_file; /* file to read character definitions from */ extern char * libdir; /* pointer to get library files from */ extern char * fontname; /* Font to use */ extern char * dateformat; /* Date/time format for headers */ extern char * sheethead; /* Header for each physical page */ /* * various global information */ extern char MPAGE[]; /* program name */ extern int ps_pagenum; /* current page count (printed or not) */ extern int ps_outpages; /* pages printed */ extern int had_ps; /* did we process ps files */ extern int first_encoding; /* first encoding in character set */ extern int last_encoding; /* last encoding in character set */ extern int mpage_level; /* keep track of multilevel mpaga calls */ extern int Coli; /* value of 0=don't mess, 1 = 4,1 (outside pages), */ extern int use_utf8; /* is the input UTF-8 or not */ extern int check_utf8; /* do we want tocheck for UTF-8 or not */ /* args.c */ int do_args(); int do_env(); /* file.c */ void do_file(); void do_pr_file(); void do_stdin(); void do_sheets(); /* glob.c */ void usage(); /* page.c */ void check_papersize(); void set_page(); int select_pagetype(); void show_pagetypes(); int xbase1(), xbase2(); int ybase1(), ybase2(), ybase3(), ybase4(); int ytop1(), ytop2(), ytop3(), ytop4(); int xwid1(), xwid2(); int yht1(), yht2(), yht4(); void outline_1(); void outline_2(); void outline_4(); void outline_8(); void sheetheader(); void mp_outline(); /* post.c */ int ps_check(); void do_ps_doc(); /* text.c */ void do_text_doc(); /* util.c */ void memgets_init(); char *memgets(); /* * For OS/2 */ #ifdef __EMX__ # define strcasecmp stricmp #endif /* * For Amiga */ #ifdef AMIGA # define popen fopen # define pclose fclose # define strcasecmp stricmp #endif ./mpage-2.5.6/page.c0000644002342000234200000002745410741127606013336 0ustar marcelmarcel/* * page.c */ /* * mpage: a program to reduce pages of print so that several pages * of output appear on one printed page. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ #include "mpage.h" #include "string.h" #define PAPERSIZE_FILE "/etc/papersize" void check_papersize() { FILE * psfp; char buf[LINESIZE]; if (access(PAPERSIZE_FILE, R_OK)) return; /* no access or no papersize file. Just do nothing */ if ((psfp = fopen(PAPERSIZE_FILE, "r")) == NULL) return; /* no access or no papersize file. Just do nothing */ while (fgets(buf, LINESIZE, psfp) != NULL) { int i = 0; int j = strlen(buf); while (i < j && (buf[i] == ' ' || buf[i] == '\t')) i++; /* skip leading space */ while (--j >= 0 && (buf[j] == ' ' || buf[j] == '\t' || buf[j] == '\n' || buf[j] == '\r')) buf[j] = '\0'; /* skip trailing space */ if (strlen(buf + i) && buf[i] != '#' ) { select_pagetype(buf + i); break; } } fclose (psfp); return; } /* check_papersize */ void set_page() { int i = select_pagetype(opt_page); media = paper[i].media; ps_width = paper[i].width; ps_height = paper[i].height; return; } /* set_page */ int select_pagetype(char *pt) { int i = 0; while (paper[i].media && strcasecmp(pt, paper[i].media)) i++; if (paper[i].media) opt_page = paper[i].media; else fprintf(stderr, "%s: ignoring unknown paper type: %s\n", MPAGE, pt); return i; } /* select_pagetype */ void show_pagetypes() { int i = 0; printf("Mpage knows about the following paper types:\n"); printf("Type Points Wide Points High\n"); printf("-------------- ----------- -----------\n"); while (paper[i].media) { printf("%-14s %11d %11d\n", paper[i].media, paper[i].width, paper[i].height); i++; } return; } /* show_pagetypes */ /* * Bases are the base for each page. e.g the corner points for outlines. */ /* __________________________ * | ________________________ | * || || * || || * || ybase4 || * || Y| * || || * || || * || ybase3 || * || Y| * || || * || || * || ybase2 || * || Y| * || || * || || * ||xbase1 xbase2 ybase1 || * |X___________X____________Y| * |__________________________| */ int xbase1() { #if 1 int val; if (opt_duplex && ((ps_pagenum % 2) == 0)) val = sheetmargin_right + sheetheader_right; else val = sheetmargin_left + sheetheader_left; Debug(DB_POINTS, "%%xbase1: %d\n", val); return val; #else Debug(DB_POINTS, "%%xbase1: %d\n", sheetmargin_left + sheetheader_left); return sheetmargin_left + sheetheader_left; #endif } /* xbase1 */ int xbase2() { #if 1 int val; if (opt_duplex && ((ps_pagenum % 2) == 0)) val = (ps_width - sheetmargin_left - sheetmargin_right - sheetheader_left - sheetheader_right) / 2 + sheetmargin_right + sheetheader_right; else val = (ps_width - sheetmargin_left - sheetmargin_right - sheetheader_left - sheetheader_right) / 2 + sheetmargin_left + sheetheader_left; Debug(DB_POINTS, "%%xbase2: %d\n", val); return (val); #else Debug(DB_POINTS, "%%xbase2: %d\n", (ps_width - sheetmargin_left - sheetmargin_right - sheetheader_left - sheetheader_right) / 2 + sheetmargin_left + sheetheader_left); return (ps_width - sheetmargin_left - sheetmargin_right - sheetheader_left - sheetheader_right) / 2 + sheetmargin_left + sheetheader_left; #endif } /* xbase2 */ int ybase1() { Debug(DB_POINTS, "%%ybase1: %d\n", sheetmargin_bottom + sheetheader_bottom); return sheetmargin_bottom + sheetheader_bottom; } /* ybase1 */ int ybase2() { Debug(DB_POINTS, "%%ybase2: %d\n", (ps_height - sheetmargin_bottom - sheetmargin_top - sheetheader_bottom - sheetheader_top) / 4 + sheetmargin_bottom + sheetheader_bottom); return (ps_height - sheetmargin_bottom - sheetmargin_top - sheetheader_bottom - sheetheader_top) / 4 + sheetmargin_bottom + sheetheader_bottom; } /* ybase2 */ int ybase3() { Debug(DB_POINTS, "%%ybase3: %d\n", (ps_height - sheetmargin_bottom - sheetmargin_top - sheetheader_bottom - sheetheader_top) / 2 + sheetmargin_bottom + sheetheader_bottom); return (ps_height - sheetmargin_bottom - sheetmargin_top - sheetheader_bottom - sheetheader_top) / 2 + sheetmargin_bottom + sheetheader_bottom; } /* ybase3 */ int ybase4() { Debug(DB_POINTS, "%%ybase4: %d\n", (ps_height - sheetmargin_bottom - sheetmargin_top - sheetheader_bottom - sheetheader_top) * 3 / 4 + sheetmargin_bottom + sheetheader_bottom); return (ps_height - sheetmargin_bottom - sheetmargin_top - sheetheader_bottom - sheetheader_top) * 3 / 4 + sheetmargin_bottom + sheetheader_bottom; } /* ybase4 */ int ytop1() { Debug(DB_POINTS, "%%ytop1: %d\n", ybase2()); /* return ybase1() + yht4(); */ return ybase2(); } /* ytop1 */ int ytop2() { Debug(DB_POINTS, "%%ytop2: %d\n", ybase3()); /* return ybase2() + yht4(); */ return ybase3(); } /* ytop2 */ int ytop3() { Debug(DB_POINTS, "%%ytop3: %d\n", ybase4()); /* return ybase3() + yht4(); */ return ybase4(); } /* ytop3 */ int ytop4() { Debug(DB_POINTS, "%%ytop4: %d\n", ps_height - sheetmargin_bottom - sheetmargin_top - sheetheader_bottom - sheetheader_top + sheetmargin_bottom + sheetheader_bottom); /* return ybase4() + yht4(); */ return ps_height - sheetmargin_bottom - sheetmargin_top - sheetheader_bottom - sheetheader_top + sheetmargin_bottom + sheetheader_bottom; } /* ytop4 */ int xwid1() { Debug(DB_POINTS, "%%xwid1: %d\n", ps_width - sheetmargin_left - sheetmargin_right - sheetheader_left - sheetheader_right); return ps_width - sheetmargin_left - sheetmargin_right - sheetheader_left - sheetheader_right; } /* xwid1 */ int xwid2() { Debug(DB_POINTS, "%%xwid2: %d\n", (ps_width - sheetmargin_left - sheetmargin_right - sheetheader_left - sheetheader_right) / 2); return (ps_width - sheetmargin_left - sheetmargin_right - sheetheader_left - sheetheader_right) / 2; } /* xwid2 */ int yht1() { Debug(DB_POINTS, "%%yht1: %d\n", ps_height - sheetmargin_top - sheetmargin_bottom - sheetheader_top - sheetheader_bottom); return ps_height - sheetmargin_top - sheetmargin_bottom - sheetheader_top - sheetheader_bottom; } /* yht1 */ int yht2() { Debug(DB_POINTS, "%%yht2: %d\n", (ps_height - sheetmargin_top - sheetmargin_bottom - sheetheader_top - sheetheader_bottom) / 2); return (ps_height - sheetmargin_top - sheetmargin_bottom - sheetheader_top - sheetheader_bottom) / 2; } /* yht2 */ int yht4() { Debug(DB_POINTS, "%%yht4: %d\n", (ps_height - sheetmargin_top - sheetmargin_bottom - sheetheader_top - sheetheader_bottom) / 4); return (ps_height - sheetmargin_top - sheetmargin_bottom - sheetheader_top - sheetheader_bottom) / 4; } /* yht4 */ void outline_1(outfd) FILE *outfd; { /* one page outline */ fprintf(outfd, "0 setlinewidth\n"); fprintf(outfd, "%d %d moveto 0 %d rlineto\n", xbase1(), ybase1(), yht1()); fprintf(outfd, "%d 0 rlineto 0 %d rlineto closepath stroke\n", xwid1(), -yht1()); return; } /* outline_1 */ void outline_2(outfd) FILE *outfd; { /* two page outline */ outline_1(outfd); fprintf(outfd, "%d %d moveto %d 0 rlineto stroke\n", xbase1(), ybase3(), xwid1()); return; } /* outline_2 */ void outline_4(outfd) FILE *outfd; { /* four page outline */ outline_2(outfd); fprintf(outfd, "%d %d moveto 0 %d rlineto stroke\n", xbase2(), ybase1(), yht1()); return; } /* outline_4 */ void outline_8(outfd) FILE *outfd; { /* eight page outline */ outline_4(outfd); fprintf(outfd, "%d %d moveto %d 0 rlineto stroke\n", xbase1(), ybase2(), xwid1()); fprintf(outfd, "%d %d moveto %d 0 rlineto stroke\n", xbase1(), ybase4(), xwid1()); return; } /* outline_8 */ void mp_outline(outfd, asheet) FILE *outfd; struct sheet *asheet; { if (opt_outline) { (*asheet->sh_outline)(outfd); } return; } /* mp_outline */ void sheetheader(outfd, fname) FILE *outfd; char *fname; { if (opt_sheetheader) { fprintf(outfd, "gsave\nheaderfont setfont\n"); switch (orientation) { case PORTRAIT: sheetheader_top = 14; #if 0 /* centered text... */ fprintf(outfd, "%d %d (%s) stringwidth pop sub 2 div add %d moveto", xbase1(), xwid1(), sheethead, ytop4() + fsize / 4); fprintf(outfd, " (%s) show\n", sheethead); #endif /* * Filename/Header on the left */ fprintf(outfd, "%d %d moveto (%s) show\n", xbase1() + 3, ytop4() + fsize / 4, *sheethead != '\0' ? sheethead : fname); /* * Pagenumber on the right */ fprintf(outfd, "%d (Page %d) stringwidth pop sub 3 sub %d moveto", xbase1() + xwid1(), ps_pagenum, ytop4() + fsize / 4); fprintf(outfd, " (Page %d) show\n", ps_pagenum); break; case LANDSCAPE: case LANDSCAPE_PORTRAIT: sheetheader_right = 14; #if 0 fprintf(outfd, "%d %d (%s) stringwidth pop 2 div add moveto", xbase1() + xwid1() + fsize/4, ybase3(), sheethead); fprintf(outfd, " -90 rotate (%s) show\n", sheethead); #endif /* * Filename/Header on the left */ fprintf(outfd, "%d %d moveto -90 rotate (%s) show\n", xbase1() + xwid1() + fsize/4, ytop4() - 3, *sheethead != '\0' ? sheethead : fname); /* * Pagenumber on the right */ fprintf(outfd, "90 rotate %d %d (Page %d) stringwidth pop ", xbase1() + xwid1() + fsize/4, ybase1() + 3, ps_pagenum); fprintf(outfd, "add moveto -90 rotate (Page %d) show\n", ps_pagenum); break; } fprintf(outfd, "grestore\n"); } return; } /* sheetheader */ ./mpage-2.5.6/post.c0000644002342000234200000007717210527164206013410 0ustar marcelmarcel/* * post.c */ /* * mpage: a program to reduce pages of print so that several pages * of output appear on one printed page. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ #include "mpage.h" #include /* * character spaces used throughout for holding the current line from * the input file */ static char currline[LINESIZE]; static char *file_name; /* * for ps documents, used to remember if we have come across the * tailer section. reset at the beginning of processing for each file */ static int ps_at_trailer; /* * this is the type of postscript document we are processing */ static int ps_posttype; /* * set to one if we have a inputline that must be preceded by something... * used for dvips output without PS comments. */ static int have_line = 0; /* * number of output lines on current logical page */ static int plcnt; int have_showsheet = 0; char ps_roff_xi [16]; /* to hold the DITROFF xi line... */ static char * tex1; /* to capture important dvi2ps lines... */ static char * tex2; /* * Function declarations */ static int ps_gettype(); static void do_post_doc(); #if 0 static void do_other_doc(); #endif static void ps_copyprolog(); static void ps_roff_copyprolog(); static void ps_mpage_copyprolog(); static void ps_skip_to_page(); static int do_post_sheet(); static void ps_sheetsetup(); static int post_onepage(); static int post_flush_onepage(); static int post_one_line(); static void do_roff_tailer(); int ps_check(); void do_ps_doc(); static int post_flush_onepage(); static int ps_store_to_page(); /* * Peek at the first two chacters on the open file and check for the * two character postscript flag "%!". If the file is not postscript * then the characters are pushed back into the input stream (hopefully). */ int ps_check(infd) FILE *infd; { int firstchar; int secondchar; Debug(DB_PSCHECK, "%%ps_check: in ps_check\n", 0); /* * eliminate blank files */ if ((firstchar = fgetc(infd)) == EOF) { Debug(DB_PSCHECK, "%%ps_check: file is blank\n", 0); return 0; } /* * Skip any CTRL-D chars * Hope there are no text files starting with ctrl-d's */ while (firstchar == 4) firstchar = fgetc(infd); /* * eliminate non-postscript files */ if (firstchar != '%') { Debug(DB_PSCHECK, "%ps_check: 1st char is '%c' not '%'\n", firstchar); if (ungetc(firstchar, infd) == EOF) { fprintf(stderr, "%s: Lost first character of file ", MPAGE); fprintf(stderr, "while checking for postscript\n."); } return 0; } Debug(DB_PSCHECK, "%%ps_check: 1st char is '%c'\n", firstchar); /* * eliminate one character files (containing only a %) */ if ((secondchar = fgetc(infd)) == EOF) { Debug(DB_PSCHECK, "%%ps_check: no second char\n", 0); if (ungetc(firstchar, infd) == EOF) { fprintf(stderr, "%s: Lost first character of file ", MPAGE); fprintf(stderr, "while checking for postscript\n."); } return 0; } /* * eliminate files that don't have the full two character * sequence of "%!". */ if (secondchar != '!') { Debug(DB_PSCHECK, "%%ps_check: 2nd char is '%c' not '!'\n", secondchar); if (ungetc(secondchar, infd) == EOF) { fprintf(stderr, "%s: Lost first two characters of ", MPAGE); fprintf(stderr, "file while checking for postscript\n."); return 0; } if (ungetc(firstchar, infd) == EOF) { fprintf(stderr, "%s: Lost first character of file ", MPAGE); fprintf(stderr, "while checking for postscript.\n"); } return 0; } /* * for post script files the first two characters (the "%!") are * digested by this routine. It's just easier than dealing * with the problems encounted if the characters can't be ungetc'ed. */ Debug(DB_PSCHECK, "%%ps_check: 2nd char is '%c'\n", secondchar); Debug(DB_PSCHECK, "%%ps_check: input is postscript\n", 0); return 1; } /* ps_check */ static int ps_gettype(fd, outfd) FILE *fd; FILE *outfd; { int ps_type, end_comments; Debug(DB_PSDOC, "%%ps_gettype: in ps_gettype\n", 0); /* * error check for truncated files */ if (fgets(currline, LINESIZE-1, fd) == NULL) { Debug(DB_PSDOC, "%%ps_gettype: got eof on first line\n", 0); return PS_NONE; } /* * check for non-conforming postscript * Note that %! is already gone down the drain... */ if (strncmp(currline, PS_FLAG, strlen(PS_FLAG)) != 0) { Debug(DB_PSDOC, "%%ps_gettype: no match PS_FLAG \"%s\"\n", currline); return PS_OTHER; } /* * we have some form of conforming postscript, try to identify the * type */ Debug(DB_PSDOC, "%%ps_gettype: conforming postscript\n", 0); end_comments = 0; ps_type = PS_CONFORM; while (!end_comments) { /* * if we get end of file then we assume non-conforming PS */ if (fgets(currline, LINESIZE-1, fd) == NULL) { Debug(DB_PSDOC, "%%ps_gettype: eof in comments\n", 0); return PS_OTHER; } /* * if we have run out of leading comments then assume * conforming PS (because we had a valid "%!" line) */ if (currline[0] != '%') { Debug(DB_PSDOC, "%%ps_gettype: out off comments\n", 0); fprintf(outfd, "%s", currline); return PS_CONFORM; } /* * print out the comment line with an extra % to disguise the comment */ fprintf(outfd, "%%%s", currline); /* * check for the end of the leading comments section */ if (strncmp(currline, "%%EndComments", 13) == 0) end_comments = 1; /* * Some tricky way to handle MS-windows postscript files... * probably doesn't work. */ if (strncmp(currline, "%%Pages:", 8) == 0 && ps_type == PS_MSWINDOWS) return ps_type; /* * once we know the type of PS, we no longer need to keep * checking. */ if (ps_type != PS_CONFORM) continue; /* * check for mpage output */ if (!strncmp(currline, "%%Creator: ", 11)) { if (!strncmp(currline+11, MPAGE, strlen(MPAGE))) { Debug(DB_PSDOC, "%%ps_gettype: mpage document\n", 0); ps_type = PS_MPAGE; } else if (!strncmp(currline+11, "Windows PSCRIPT", 15)) { Debug(DB_PSDOC, "%%ps_gettype: windows document\n", 0); ps_type = PS_MSWINDOWS; } else if (!strncmp(currline+11, "dvips", 5)) { Debug(DB_PSDOC, "%%ps_gettype: dvips\n", 0); ps_type = PS_TEX; } } /* * check for psroff/tex output */ if (strncmp(currline, "%%Title: ", 9) == 0) { if (strstr(currline, "ditroff")) { Debug(DB_PSDOC, "%%ps_gettype: psroff\n", 0); ps_type = PS_PSROFF; } else if (strstr(currline, ".dvi")) { Debug(DB_PSDOC, "%%ps_gettype: dvi2ps\n", 0); ps_type = PS_TEX; } } if (strncmp(currline, "%DVIPS", 6) == 0) { Debug(DB_PSDOC, "%%ps_gettype: dvips\n", 0); if (ps_type != PS_TEX) ps_type = PS_TEX2; return ps_type; } } #ifdef DEBUG if (ps_type == PS_CONFORM) { Debug(DB_PSDOC, "%%ps_gettype: unknown type, conforming PS\n", 0); } #endif return ps_type; } /* ps_gettype */ void do_ps_doc(fd, asheet, outfd, fname) FILE *fd; struct sheet *asheet; FILE *outfd; char * fname; { Debug(DB_PSDOC, "%%do_ps_doc: postscript document\n", 0); file_name = fname; ps_posttype = ps_gettype(fd,outfd); Debug(DB_PSDOC, "%%do_ps_doc: document type is %d\n", ps_posttype); if (ps_posttype != PS_NONE) do_post_doc(fd, asheet, outfd); return; } /* do_ps_doc */ static void do_post_doc(fd, asheet, outfd) FILE *fd; struct sheet *asheet; FILE *outfd; { ps_at_trailer = FALSE; Debug(DB_POST, "%%do_post_doc: prolog\n", 0); ps_copyprolog(fd, outfd); /* * while there is still input, print pages */ Debug(DB_POST, "%%do_post_doc: pages\n", 0); do_sheets(do_post_sheet, fd, asheet, outfd); Debug(DB_POST, "%%do_post_doc: trailer\n", 0); do_roff_tailer(fd, outfd); return; } /* do_post_doc */ #if 0 /* not used yet... */ static void do_other_doc(fd, asheet, outfd) FILE *fd; struct sheet *asheet; FILE *outfd; { ps_at_trailer = FALSE; ps_copyprolog(fd, outfd); return; } /* do_other_doc */ #endif static void ps_copyprolog(fd, outfd) FILE *fd; FILE *outfd; { Debug(DB_PSDOC, "%%ps_copyprolog: adding mpage prolog\n", 0); if (!have_showsheet) { #if 1 fprintf(outfd, "/showsheet /showpage load def\n"); #else fprintf(outfd, "/showsheet { showpage } bind def\n"); #endif fprintf(outfd, "/showpage { } def\n"); have_showsheet = 1; } had_ps = 1; Debug(DB_PSDOC, "%%ps_copyprolog: copying prolog\n", 0); if (ps_posttype == PS_PSROFF) { Debug(DB_PSDOC, "%%ps_copyprolog: calling ps_roff_copyprolog\n",0); ps_roff_copyprolog(fd, outfd); return; } if (ps_posttype == PS_MPAGE) { Debug(DB_PSDOC, "%%ps_copyprolog: calling ps_mpage_copyprolog\n",0); ps_mpage_copyprolog(fd, outfd); return; } while (fgets(currline, LINESIZE-1, fd) != NULL) { if (strncmp(currline, "%%Page:", 7) == 0) { fprintf(outfd, "%% %s", currline); return; } if (ps_posttype == PS_TEX || ps_posttype == PS_TEX2) { if (ps_posttype == PS_TEX2 && strstr(currline, " bop ")) { /* dvips output without comments... */ have_line = 1; return; } if (strncmp(currline, "TeXDict", 7) == 0) { /* SHOULD PROBABLY REMOVE THIS. SEE BELOW /dictionarystack */ /* * Hope all dvi2ps progs work the same: * capture the TeX init code so we can run it 'manually' for * every page. This is needed as this code sets up a gstate * that conflicts with mpage... * This trick seems to work for text, but figures within the dvi * file seem to have a mind of their own... */ if (tex1) free(tex1); tex1 = malloc(strlen(currline)+1); strcpy(tex1, currline); fprintf(outfd, "%s", currline); fgets(currline, LINESIZE-1, fd); if (tex2) free(tex2); tex2 = malloc(strlen(currline)+1); strcpy(tex2, currline); } } fprintf(outfd, "%s", currline); } Debug(DB_PSDOC, "%%ps_copyprolog: eof before %%%%EndProlog\n", 0); fprintf(outfd, "%%%%EndProlog\n"); return; } /* ps_copyprolog */ static void ps_roff_copyprolog(fd, outfd) FILE *fd; FILE *outfd; { Debug(DB_PSDOC, "%%ps_roff_copyprolog: copying psroff prolog\n", 0); while(fgets(currline, LINESIZE-1, fd) != NULL) { /* if (strcmp(currline, "xi\n") == 0) */ if (strstr(currline, "xi\n")) { fprintf(outfd, "%%%s", currline); strcpy(ps_roff_xi, currline); } else if (strncmp(currline, "%%Page:", 7) == 0) { fprintf(outfd, "/p { } def\n"); fprintf(outfd, "/xt { } def\n"); fprintf(outfd, "/xs { } def\n"); fprintf(outfd, "%% %s", currline); Debug(DB_PSDOC, "%%ps_copyprolog: Done\n", 0); return; } else fprintf(outfd, "%s", currline); } Debug(DB_PSDOC, "%%ps_copyprolog: eof before %%%%EndProlog\n", 0); fprintf(outfd, "/p { } def\n"); fprintf(outfd, "/xt { } def\n"); fprintf(outfd, "/xs { } def\n"); fprintf(outfd, "%%%%EndProlog\n"); return; } /* ps_roff_copyprolog */ static void ps_mpage_copyprolog(fd, outfd) FILE *fd; FILE *outfd; { Debug(DB_PSDOC, "%%ps_mpage_copyprolog: skipping mpage prolog\n", 0); while(fgets(currline, LINESIZE-1, fd) != NULL) { if (strncmp(currline, "%%Page:", 7) == 0) { fprintf(outfd, "%% %s", currline); Debug(DB_PSDOC, "%%ps_copyprolog: Done\n", 0); return; } } } /* ps_mpage_copyprolog */ static void ps_skip_to_page(fd) FILE *fd; { Debug(DB_PSDOC, "%%ps_skip to page: reading until %%%%Page:\n", 0); while(fgets(currline, LINESIZE-1, fd) != NULL) { Debug(DB_PSDOC, "%% %s", currline); if (strncmp(currline, "%%Page:", 7) == 0) return; } Debug(DB_PSDOC, "%%ps_skip_to_page: eof before %%%%Page:\n", 0); return; } /* ps_skip_to_page */ static char *stored_page = NULL; static int stored_page_size = 0; static int ps_store_to_page(fd) FILE *fd; { int totlen = 0; Debug(DB_PSDOC, "%%ps_store to page: reading until %%%%Page:\n", 0); while(fgets(currline, LINESIZE-1, fd) != NULL) { int len; if (strncmp(currline, "%%Page:", 7) == 0) return totlen; len = strlen(currline); totlen += len; if (totlen > stored_page_size){ stored_page = realloc(stored_page, totlen); stored_page_size = totlen; } /* do not copy the '\0' */ memcpy(stored_page + totlen - len, currline, len); Debug(DB_PSDOC, "%% %s", currline); } Debug(DB_PSDOC, "%%ps_store_to_page: eof before %%%%Page:\n", 0); return totlen; } /* ps_store_to_page */ /* GPN */ /* #define NSCALE to take care of previous scaling */ #ifdef NSCALE char *NScale = "/gpnsavematrix {orgmatrix currentmatrix pop} bind def\n" "/gpnrestorematrix {orgmatrix setmatrix} bind def\n" "/orgmatrix matrix def\n" "gpnsavematrix\n" "orgmatrix orgmatrix invertmatrix pop\n" "/gpnxs\n" " orgmatrix 0 get 0.0000 eq\n" " {orgmatrix 1 get abs}\n" " {orgmatrix 0 get abs}\n" " ifelse def\n" "/gpnys\n" " orgmatrix 3 get 0.0000 eq\n" " {orgmatrix 2 get abs}\n" " {orgmatrix 3 get abs}\n" " ifelse def\n" "/gpnxs gpnxs gscurrentresolution 0 get 72 div mul def\n" "/gpnys gpnys gscurrentresolution 1 get 72 div mul def\n"; #endif /* NSCALE */ static int do_post_sheet(fd, asheet, outfd) FILE *fd; struct sheet *asheet; FILE *outfd; { int rtn_val = FILE_MORE; int sh_high, sh_wide; struct pagepoints *stored_points = NULL, *flush_points = NULL; int flush = 0, totlen = 0; do { if ((points->pp_origin_x == 0 && !points->skip) || opt_file || flush) { /* * keep track of the pages processed */ ps_pagenum++; fprintf(outfd, "%%%%Page: %d %d\n", ps_pagenum, ps_pagenum); # ifdef DEBUG if (Debug_flag & DB_PSMPAGE) fprintf(outfd, "(Page: %d\\n) print flush\n", ps_pagenum); # endif /* DEBUG */ #if 0 /* seems to give memory problems... */ fprintf(outfd, "/sheetsave save def\n"); #endif /* * Now is the time to print a sheet header... * for now, this has to be done before outline... */ sheetheader(outfd, file_name); /* * print the page outline */ mp_outline(outfd, asheet); /* * run through the list of base points for putting reduced pages * on the printed page */ if (!flush) points = asheet->sh_pagepoints; else points++; } while ((points->pp_origin_x!=0 || points->skip) && rtn_val == FILE_MORE) { /* GPN. skip this page ?*/ if (points->skip!=0) { switch (points->skip) { case SKIP_PS: /* * Skip this page. User needs another run with the other * of -O/-E option. */ ps_skip_to_page(fd); points++; continue; case STORE_PS: /* * stored_page could also be an array * if more than one page * is needed */ totlen = ps_store_to_page(fd); stored_points = points; flush = STORE_PS; points++; continue; case FLUSH_PS: if (stored_points) { /* * Ok I have to print the page and start a new one. * This could be more elegant, but for now... */ /* fprintf(outfd, "showsheet\n"); ps_pagenum++; fprintf(outfd, "%%%%Page: %d %d\n", ps_pagenum, ps_pagenum); sheetheader(outfd, file_name); mp_outline(outfd, asheet); */ flush = FLUSH_PS; flush_points = points; points = stored_points; } else flush = 0; } } /* * Save current graphics context so we can scale/translate * from known position and size. */ fprintf(outfd, "gsave\n"); /* * print one reduced page by moving to the proper point, * turning to the proper aspect, scaling to the proper * size, and setting up a clip path to prevent overwritting; * then print a reduced page of output. */ Debug(DB_PSMPAGE, "%%%% %%%%ReducedPageStartsHere\n", outfd); # ifdef DEBUG if (Debug_flag & DB_PSMPAGE) { fprintf(outfd, "( %d %d translate %d rotate\\n)", points->pp_origin_x(), points->pp_origin_y(), asheet->sh_rotate); fprintf(outfd, " print flush\n"); } # endif /* DEBUG */ #ifdef NSCALE /*GPN*/ fprintf (outfd, NScale); fprintf(outfd, "%d gpnxs mul %d gpnxs mul translate %d rotate\n", points->pp_origin_x(), points->pp_origin_y(), asheet->sh_rotate); #else /* NSCALE */ fprintf(outfd, "%d %d translate\n", points->pp_origin_x(), points->pp_origin_y()); if (asheet->sh_rotate) fprintf(outfd, "%d rotate\n", asheet->sh_rotate); #endif sh_wide = (*asheet->sh_width)(); sh_high = (*asheet->sh_height)(); /* output the clip path */ #ifdef NSCALE /*GPN*/ fprintf(outfd, "0 0 moveto 0 %d gpnys mul lineto %d gpnxs mul" " %d gpnys mul lineto ", sh_high, sh_wide, sh_high); fprintf(outfd, "%d gpnxs mul 0 lineto\n", sh_wide); fprintf(outfd, "closepath clip\n"); #else /* NSCALE */ #if 0 fprintf(outfd, "0 0 moveto 0 %d lineto %d %d lineto ", sh_high, sh_wide, sh_high); fprintf(outfd, "%d 0 lineto\n", sh_wide); #else fprintf(outfd, "1 1 moveto 1 %d lineto %d %d lineto ", sh_high - 1, sh_wide - 1, sh_high - 1); fprintf(outfd, "%d 1 lineto\n", sh_wide - 1); #endif fprintf(outfd, "closepath clip newpath\n"); #endif /* NSCALE */ if (opt_square) { int newhigh = sh_high, newwide = sh_wide; if (sh_wide * ps_height > sh_high * ps_width) newwide = (sh_high * ps_width) / ps_height; else newhigh = (sh_wide * ps_height) / ps_width; #ifdef NSCALE /*GPN*/ fprintf(outfd, "%d gpnxs mul %d gpnys mul translate\n", #else fprintf(outfd, "%d %d translate\n", #endif (sh_wide - newwide) / 2, (sh_high - newhigh) / 2); sh_wide = newwide; sh_high = newhigh; } fprintf(outfd, "%d %d div %d %d div scale\n", sh_wide, ps_width, sh_high, ps_height); /* * Take extra page margins into account */ fprintf(outfd, "%d %d div %d %d div scale\n", ps_width, ps_width + pagemargin_left + pagemargin_right, ps_height, ps_height + pagemargin_top + pagemargin_bottom); #ifndef NSCALE fprintf(outfd, "%d %d translate\n", pagemargin_left, pagemargin_bottom); #endif #if 0 /* does not seem to be neccessary. seems to create dictionary * stack underflows... */ if ((ps_posttype == PS_TEX || ps_posttype == PS_TEX2) && tex1) /* start dvi2ps init every page */ fprintf(outfd, "%s%s", tex1, tex2); #endif /* * do the individual sheet setup */ ps_sheetsetup(outfd); /* * place one reduce page on the printed page */ plcnt = 0; if (flush == FLUSH_PS) { rtn_val = post_flush_onepage(totlen, asheet, outfd); stored_points = NULL; points = flush_points; } else { rtn_val = post_onepage(fd, asheet, outfd); points++; } /* * clean up after mpage has drawn its page */ fprintf(outfd, "grestore\n"); } #if 0 fprintf(outfd, "sheetsave restore\n"); #endif /* * print the sheet */ if (points->pp_origin_x == 0 || (rtn_val == FILE_EOF && opt_file)) fprintf(outfd, "showsheet\n"); } while (flush && rtn_val == FILE_MORE); if (stored_points) { flush_points = points; points = stored_points; /* * Save current graphics context so we can scale/translate * from known position and size. */ fprintf(outfd, "gsave\n"); /* * print one reduced page by moving to the proper point, * turning to the proper aspect, scaling to the proper * size, and setting up a clip path to prevent overwritting; * then print a reduced page of output. */ Debug(DB_PSMPAGE, "%%%% %%%%ReducedPageStartsHere\n", outfd); # ifdef DEBUG if (Debug_flag & DB_PSMPAGE) { fprintf(outfd, "( %d %d translate %d rotate\\n)", points->pp_origin_x(), points->pp_origin_y(), asheet->sh_rotate); fprintf(outfd, " print flush\n"); } # endif /* DEBUG */ #ifdef NSCALE /*GPN*/ fprintf (outfd, NScale); fprintf(outfd, "%d gpnxs mul %d gpnxs mul translate %d rotate\n", points->pp_origin_x(), points->pp_origin_y(), asheet->sh_rotate); #else /* NSCALE */ fprintf(outfd, "%d %d translate\n", points->pp_origin_x(), points->pp_origin_y()); if (asheet->sh_rotate) fprintf(outfd, "%d rotate\n", asheet->sh_rotate); #endif sh_wide = (*asheet->sh_width)(); sh_high = (*asheet->sh_height)(); /* output the clip path */ #ifdef NSCALE /*GPN*/ fprintf(outfd, "0 0 moveto 0 %d gpnys mul lineto %d gpnxs mul" " %d gpnys mul lineto ", sh_high, sh_wide, sh_high); fprintf(outfd, "%d gpnxs mul 0 lineto\n", sh_wide); fprintf(outfd, "closepath clip\n"); #else /* NSCALE */ #if 0 fprintf(outfd, "0 0 moveto 0 %d lineto %d %d lineto ", sh_high, sh_wide, sh_high); fprintf(outfd, "%d 0 lineto\n", sh_wide); #else fprintf(outfd, "1 1 moveto 1 %d lineto %d %d lineto ", sh_high - 1, sh_wide - 1, sh_high - 1); fprintf(outfd, "%d 1 lineto\n", sh_wide - 1); #endif fprintf(outfd, "closepath clip newpath\n"); #endif /* NSCALE */ if (opt_square) { int newhigh = sh_high, newwide = sh_wide; if (sh_wide * ps_height > sh_high * ps_width) newwide = (sh_high * ps_width) / ps_height; else newhigh = (sh_wide * ps_height) / ps_width; #ifdef NSCALE /*GPN*/ fprintf(outfd, "%d gpnxs mul %d gpnys mul translate\n", #else fprintf(outfd, "%d %d translate\n", #endif (sh_wide - newwide) / 2, (sh_high - newhigh) / 2); sh_wide = newwide; sh_high = newhigh; } fprintf(outfd, "%d %d div %d %d div scale\n", sh_wide, ps_width, sh_high, ps_height); /* * Take extra page margins into account */ fprintf(outfd, "%d %d div %d %d div scale\n", ps_width, ps_width + pagemargin_left + pagemargin_right, ps_height, ps_height + pagemargin_top + pagemargin_bottom); #ifndef NSCALE fprintf(outfd, "%d %d translate\n", pagemargin_left, pagemargin_bottom); #endif #if 0 /* does not seem to be neccessary. seems to create dictionary * stack underflows... */ if ((ps_posttype == PS_TEX || ps_posttype == PS_TEX2) && tex1) /* start dvi2ps init every page */ fprintf(outfd, "%s%s", tex1, tex2); #endif /* * do the individual sheet setup */ ps_sheetsetup(outfd); /* * place one reduce page on the printed page */ plcnt = 0; rtn_val = post_flush_onepage(totlen, asheet, outfd); stored_points = NULL; /* * clean up after mpage as drawn its page */ fprintf(outfd, "grestore\n"); #if 0 fprintf(outfd, "sheetsave restore\n"); #endif /* * print the sheet */ if (points->pp_origin_x == 0 || (rtn_val == FILE_EOF && opt_file)) fprintf(outfd, "showsheet\n"); } /* * let the upper level know about the status of possible EOF */ return rtn_val; } /* do_post_sheet */ static void ps_sheetsetup(outfd) FILE *outfd; { switch (ps_posttype) { case PS_PSROFF: fprintf(outfd, "%s", ps_roff_xi); fprintf(outfd, "/p {} def\n"); break; /* case PS_MPAGE: fprintf(outfd, "/showpage {} def\n"); break; */ } return; } /* ps_sheetsetup */ static int post_onepage(fd, asheet, outfd) FILE *fd; struct sheet *asheet; FILE *outfd; { int indoc = 0; Debug(DB_PSROFF, "%%post_onepage: Begin page\n", 0); if (ps_at_trailer) { Debug(DB_PSROFF, "%%post_onepage: still at trailer\n", 0); return FILE_EOF; } if (have_line) { fprintf(outfd, "%s", currline); have_line = 0; } while(fgets(currline, LINESIZE-1, fd) != NULL) { int line_rc; line_rc = post_one_line(currline, fd, outfd, &indoc, 0); if (line_rc != FILE_CONT) return line_rc; } Debug(DB_PSROFF, "%%post_onepage: eof\n", 0); return FILE_EOF; } /* post_onepage */ static int post_flush_onepage(totlen, asheet, outfd) int totlen; struct sheet *asheet; FILE *outfd; { int indoc = 0; Debug(DB_PSROFF, "%%post_flush_onepage: Begin page\n", 0); /* if (ps_at_trailer) { Debug(DB_PSROFF, "%%post_flush_onepage: still at trailer\n", 0); return FILE_EOF; } */ if (have_line) { fprintf(outfd, "%s", currline); have_line = 0; } memgets_init(stored_page, totlen); while (memgets(currline, LINESIZE-1) != NULL) { int line_rc; line_rc = post_one_line(currline, (FILE *) NULL, outfd, &indoc, 1); if (line_rc != FILE_CONT) return line_rc; } Debug(DB_PSROFF, "%%post_flush_onepage: eof\n", 0); return FILE_MORE; } /* post_flush_onepage */ static int post_one_line(line, fd, outfd, indoc, flush_page) char * line; FILE *fd; FILE *outfd; int * indoc; int flush_page; { if (strncmp(line, "%%BeginDocument", 15) == 0) { (*indoc)++; } if (strncmp(line, "%%EndDocument", 13) == 0) { (*indoc)--; } if (!*indoc) { if (strncmp(line, "%%Page:", 7) == 0) { fprintf(outfd, "%% %s", line); /* * only if there is already output to this logical page */ if (!plcnt) return FILE_CONT; Debug(DB_PSROFF, "%%post_one_line: next page\n", 0); return FILE_MORE; } if (opt_killtrail && (strncmp(line, "%%Trailer", 9) == 0 || strncmp(line, "%%PSTrailer", 11) == 0)) { fprintf(outfd, "%% %s", line); Debug(DB_PSROFF, "%%post_one_line: found trailer\n", 0); ps_at_trailer = TRUE; return FILE_EOF; } /* For netscape output */ if (strncmp(line, "%%EOF", 5) == 0) { fprintf(outfd, "%% %s", line); Debug(DB_PSROFF, "%%post_one_line: Netscape EOF\n", 0); return FILE_EOF; } if (ps_posttype == PS_MPAGE && strncmp(line, "showsheet", 9) == 0) return FILE_CONT; if (ps_posttype == PS_TEX || ps_posttype == PS_TEX2) { if (ps_posttype == PS_TEX2 && (strstr(line, "eop\n") || strstr(line, "eop end\n"))) { fprintf(outfd, "%s", line); Debug(DB_PSROFF, "%%post_one_line: found TEX eop\n", 0); return FILE_MORE; } if (strncmp(line, "TeXDict", 7) == 0) { /* * Hope all dvi2ps progs work the same: * capture the TeX init code so we can run it 'manually' for * every page. This is needed as this code sets up a gstate * that conflicts with mpage... * This trick seems to work for text, but figures within the dvi * file seem to have a mind of their own... */ if (tex1) free(tex1); tex1 = malloc(strlen(line)+1); strcpy(tex1, line); fprintf(outfd, "%s", line); flush_page ? memgets(line, LINESIZE-1) : fgets(line, LINESIZE-1, fd); if (tex2) free(tex2); tex2 = malloc(strlen(line)+1); strcpy(tex2, line); } } } fprintf(outfd, "%s", line); plcnt++; return FILE_CONT; } /* post_one_line */ static void do_roff_tailer(fd, outfd) FILE *fd, *outfd; { #ifdef DEBUG int i = 0; #endif Debug(DB_PSDOC, "%%do_roff_trailer: looking for eof\n", 0); while(fgets(currline, LINESIZE-1, fd) != NULL) { #ifdef DEBUG i++; Debug(DB_PSDOC, "%%%s", currline); #endif ; } Debug(DB_PSDOC, "%%do_roff_trailer: tailer of %d lines\n", i); return; } /* do_roff_tailer */ ./mpage-2.5.6/sample.c0000644002342000001440000000600110056433554013561 0ustar marcelusers/* * sample.c */ /* * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands */ # include "mpage.h" /* * Function Declarations */ static void do_sample(); static void urshow(); static void lrshow(); static void ulshow(); static void llshow(); static void box(); int main(argc, argv) int argc; char **argv; { int currarg; /* * examine the environment for PRINTER and MPAGE environment variables */ if ((currarg = do_env()) == 0) { usage(currarg); exit(1); } if ((currarg = do_args(argc, argv, 0)) < 0) { usage(currarg); exit(1); } do_sample(); exit(0); } /* main */ static void do_sample() { printf("%%!PS-mpage-layout\n"); printf("/Courier findfont 8 scalefont setfont\n"); printf("0 setlinewidth\n"); outline_8(stdout); urshow(xbase1(), ybase1()); urshow(xbase1(), ybase2()); urshow(xbase1(), ybase3()); urshow(xbase1(), ybase4()); lrshow(xbase1(), ytop1()); lrshow(xbase1(), ytop2()); lrshow(xbase1(), ytop3()); lrshow(xbase1(), ytop4()); ulshow(xbase1()+xwid2(), ybase1()); ulshow(xbase1()+xwid2(), ybase2()); ulshow(xbase1()+xwid2(), ybase3()); ulshow(xbase1()+xwid2(), ybase4()); llshow(xbase1()+xwid2(), ytop1()); llshow(xbase1()+xwid2(), ytop2()); llshow(xbase1()+xwid2(), ytop3()); llshow(xbase1()+xwid2(), ytop4()); urshow(xbase2(), ybase1()); urshow(xbase2(), ybase2()); urshow(xbase2(), ybase3()); urshow(xbase2(), ybase4()); lrshow(xbase2(), ytop1()); lrshow(xbase2(), ytop2()); lrshow(xbase2(), ytop3()); lrshow(xbase2(), ytop4()); ulshow(xbase2()+xwid2(), ybase1()); ulshow(xbase2()+xwid2(), ybase2()); ulshow(xbase2()+xwid2(), ybase3()); ulshow(xbase2()+xwid2(), ybase4()); llshow(xbase2()+xwid2(), ytop1()); llshow(xbase2()+xwid2(), ytop2()); llshow(xbase2()+xwid2(), ytop3()); llshow(xbase2()+xwid2(), ytop4()); printf("showpage\n"); return; } /* do_sample */ static void urshow(int x, int y) { printf("%%- point %d,%d\n", x, y); box(x, y); printf("\t%d %d moveto (%d,%d) show\n", x+2, y+2, x, y); return; } /* urshow */ static void lrshow(int x, int y) { printf("%%- point %d,%d\n", x, y); box(x, y); printf("\t%d %d moveto (%d,%d) show\n", x+2, y-6, x, y); return; } /* lrshow */ static void ulshow(int x, int y) { printf("%%- point %d,%d\n", x, y); box(x, y); printf("\t%d %d moveto\n", x-2, y+2); printf("\t(%d,%d) dup stringwidth pop -1 mul 0 rmoveto show\n", x, y); return; } /* ulshow */ static void llshow(int x, int y) { printf("%%- point %d,%d\n", x, y); box(x, y); printf("\t%d %d moveto\n", x-2, y-6); printf("\t(%d,%d) dup stringwidth pop -1 mul 0 rmoveto show\n", x, y); return; } /* llshow */ static void box(int x, int y) { printf("\t%d %d moveto %d %d lineto\n", x-1, y, x+1, y); printf("\t%d %d moveto %d %d lineto\n", x, y-1, x, y+1); printf("\tstroke\n"); return; } /* box */ ./mpage-2.5.6/text.c0000644002342000234200000004745510056433550013406 0ustar marcelmarcel/* * text.c */ /* * mpage: a program to reduce pages of print so that several pages * of output appear on one printed sheet. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ #include "mpage.h" #include /* Ultrix... Michael Fulbright msf@as.arizona.edu */ #include #include extern char *current_locale; /* * keeps track of the current location on the sheet. it is kept global * to while file printing process because of form feeds in particular. * form feeds change the vertical page location (line number) but not * the horizontal location (character column) */ struct pageloc { int pl_line; int pl_col; int pl_new_line; int pl_new_col; }; static struct pageloc loc; static char text[LINESIZE]; static char *file_name; static int file_pagenum; static char file_date[LINESIZE]; /* * Function Declarations */ static int do_text_sheet(); static int text_onepage(); static char *mp_get_text(); #ifdef KANJI int get_wc( FILE * ); #endif /* * do_text_doc processes an input stream fd, reducing output to fit on * a printed page as decribed by asheet, and prints this on outfd. */ void do_text_doc(fd, asheet, outfd, fname) FILE *fd; struct sheet *asheet; FILE *outfd; char * fname; { struct stat file_stat; /* * initalize the postion on the first printed page */ loc.pl_line = 1; loc.pl_col = opt_indent; file_name = fname; file_pagenum = 0; fstat(fileno(fd), &file_stat); strftime(file_date, LINESIZE, dateformat, localtime(&file_stat.st_mtime)); /* * while we have input, print a page */ do_sheets(do_text_sheet, fd, asheet, outfd ); return; } /* do_text_doc */ /* * do_text_sheet creates one printed sheet consisting of several reduced pages */ static int do_text_sheet(fd, asheet, outfd) FILE *fd; struct sheet *asheet; FILE *outfd; { int rtn_val = FILE_MORE; int peekc; if ((peekc = getc(fd)) == EOF) return FILE_EOF; ungetc(peekc, fd); if (((points->pp_origin_x == 0) && !points->skip) || opt_file) { /* * keep track of the pages printed */ ps_pagenum++; fprintf(outfd, "%%%%Page: %d %d\n", ps_pagenum, ps_pagenum); # ifdef DEBUG if (Debug_flag & DB_PSMPAGE) fprintf(outfd, "(Page: %d\\n) print flush\n", ps_pagenum); # endif /* DEBUG */ fprintf(outfd, "save\n"); /* for better memory usage */ /* * Now is the time to print a sheet header... * for now, this has to be done before outline... */ sheetheader(outfd, file_name); /* * print the page outline, which draws lines and such */ mp_outline(outfd, asheet); /* * run through the list of base points for putting reduced pages * on the printed page */ points = asheet->sh_pagepoints; } /* while (points->pp_origin_x != 0 && rtn_val == FILE_MORE) {} */ while ((points->pp_origin_x != 0 || points->skip) && rtn_val == FILE_MORE) { /* * print one reduced page by moving to the proper point, * turning to the proper aspect, scaling to the proper * size, and setting up a clip path to prevent overwriting; * then` print a reduced page of output. */ int pheight; file_pagenum++; if (points->skip) { rtn_val = text_onepage(fd, asheet, outfd); points++; continue; } fprintf(outfd, "gsave\n"); # ifdef DEBUG if (Debug_flag & DB_PSMPAGE) { fprintf(outfd, "( %d %d translate %d rotate\\n)", points->pp_origin_x(), points->pp_origin_y(), asheet->sh_rotate); fprintf(outfd, " print flush\n"); } # endif /* DEBUG */ /* * Take position on paper */ fprintf(outfd, "%d %d translate\n", points->pp_origin_x(), points->pp_origin_y()); if (asheet->sh_rotate) fprintf(outfd, "%d rotate\n", asheet->sh_rotate); /* * Clip to logical page */ fprintf(outfd, "0 0 moveto 0 %d rlineto %d 0 rlineto 0 %d rlineto closepath clip\n", (*asheet->sh_height)(), (*asheet->sh_width)(), -(*asheet->sh_height)()); pheight = asheet->sh_plength * fsize + (opt_mp_header ? HSIZE + 2 : 0); /* * Scale to logical page */ fprintf(outfd, "%d %d mp_a_x mul div %d %d div scale\n", (*asheet->sh_width)(), asheet->sh_cwidth, (*asheet->sh_height)(), pheight); /* * Draw header bar and print header when needed */ if (opt_mp_header) { int pos = (asheet->sh_plength) * fsize; fprintf(outfd, "newpath 0 %d moveto %d mp_a_x mul 0 rlineto stroke\n", pos, asheet->sh_cwidth); pos += 4; fprintf(outfd, "headerfont setfont\n"); if (opt_header != NULL) fprintf(outfd, "3 %d moveto (%s) show\n", pos, opt_header); else { fprintf(outfd, "3 %d moveto (%s) show\n", pos, file_date); fprintf(outfd, "%d mp_a_x mul dup (Page %d) stringwidth pop " "sub 3 sub %d moveto", asheet->sh_cwidth, file_pagenum, pos); fprintf(outfd, " (Page %d) show\n", file_pagenum); fprintf(outfd, "fnamefont setfont\n"); #if 0 /* seems stringvals cannot be dup-ed... */ fprintf(outfd, "(%s) dup stringwidth pop sub 2 div %d moveto show\n", file_name, pos); #else fprintf(outfd, "(%s) stringwidth pop sub 2 div %d moveto\n", file_name, pos); fprintf(outfd, "(%s) show\n", file_name); #endif } } /* * Take pagemargin and font descenders (fsize/4) into account * and scale again */ fprintf(outfd, "%d %d translate %d %d div %d %d div scale\n", pagemargin_left, pagemargin_bottom + fsize/4, (*asheet->sh_width)() - pagemargin_left - pagemargin_right, (*asheet->sh_width)(), asheet->sh_plength * fsize - pagemargin_top - pagemargin_bottom, asheet->sh_plength * fsize); /* * not sure, selection of correct font is difficult. * so guessing it from locale, and always use it for UTF-8 */ if (use_utf8 && current_locale) { if (!strncmp (current_locale, "ja_JP", 5)) fprintf (outfd, "unijis setfont\n"); else if (!strncmp (current_locale, "ko_KR", 5)) fprintf (outfd, "uniks setfont\n"); else if (!strncmp (current_locale, "zh_CN", 5)) fprintf (outfd, "unigb setfont\n"); else if (!strncmp (current_locale, "zh_TW", 5)) fprintf (outfd, "unicns setfont\n"); else fprintf (outfd, "textfont setfont\n"); } else fprintf(outfd, "textfont setfont\n"); /* * place one reduced page on the printed page */ rtn_val = text_onepage(fd, asheet, outfd); /* * clean up this page and move to the next */ fprintf(outfd, "grestore\n"); points++; } /* * release PS vm used, and eject the sheet */ if (points->pp_origin_x == 0 || (rtn_val == FILE_EOF && opt_file)) { fprintf(outfd, "restore\n"); if (had_ps) fprintf(outfd, "showsheet\n"); else fprintf(outfd, "showpage\n"); } /* * let the upper level know about the status of possible EOF */ return rtn_val; } /* do_text_sheet */ /* * text_onepage places on page of reduced output on the printed page * all scaling, translation, and rotation has already been done before */ static int text_onepage(file, asheet, outfd) FILE *file; struct sheet *asheet; FILE *outfd; { char *text; #ifdef KANJI int kcode; int loadfont = 0; int i; #endif /* * Start off with printing any wanted annotation */ if (opt_textbox) { fprintf(outfd, "%d setlinewidth\n", textbox.thick); fprintf(outfd, "%d mp_a_x mul %d moveto 0 %d rlineto\n", textbox.over, textbox.lift*fsize, textbox.high*fsize); fprintf(outfd, "%d mp_a_x mul 0 rlineto 0 %d rlineto closepath stroke\n", textbox.wide, -textbox.high*fsize); } /* * as we move from one page to the next, restart printing text at * the head of the page. horziontal location is not reset because * form feeds leave the column the same from page to page. */ Debug(DB_ONEPAGE, "%% reseting line to top of page\n", 0); loc.pl_line = 1; /* * keep getting lines of input, until we have filled a page */ while (loc.pl_line <= asheet->sh_plength) { #ifndef KANJI text = mp_get_text(file, &loc, asheet); #else text = mp_get_text(file, &loc, asheet, &kcode ); if (kcode) { if (kcode < 0x0100) { /* hankaku */ if (loadfont != 2) { fprintf(outfd, "han setfont\n"); loadfont = 2; } } else { /* zenkaku */ if (loadfont != 1) { fprintf(outfd, "kanj setfont\n"); loadfont = 1; } } i = loc.pl_col; if (kcode >= 0x80 && kcode < 0x100) i--; switch (i) { /* fprintf(outfd, "(%s\\n) print flush\n", text); */ case 0: putc('0', outfd); break; case 1: fprintf(outfd, "mp_a_x"); break; default: fprintf(outfd, "%d mp_a_x mul", i); break; } fprintf(outfd, " %d moveto <%04x> show\n", (asheet->sh_plength - loc.pl_line) * fsize, kcode); text[0] = 0; } else if (loadfont) { fprintf(outfd, "textfont setfont\n"); loadfont = 0; } #endif Debug(DB_ONEPAGE, "%% text = %d\n", text); if (text == 0) { return FILE_EOF; } Debug(DB_ONEPAGE, "%% text = (%s)\n", text); Debug(DB_ONEPAGE, "%% loc.pl_line = %d\n", loc.pl_line); Debug(DB_ONEPAGE, "%% loc.pl_col = %d\n", loc.pl_col); Debug(DB_ONEPAGE, "%% loc.pl_new_line = %d\n",loc.pl_new_line); Debug(DB_ONEPAGE, "%% loc.pl_new_col = %d\n", loc.pl_new_col); if (text[0] != 0 && !points->skip) { switch (loc.pl_col) { /* fprintf(outfd, "(%s\\n) print flush\n", text); */ case 0: putc('0', outfd); break; case 1: fprintf(outfd, "mp_a_x"); break; default: fprintf(outfd, "%d mp_a_x mul", loc.pl_col); break; } fprintf(outfd, " %d moveto (%s) show\n", (asheet->sh_plength - loc.pl_line) * fsize, text); } if (loc.pl_new_line == -1) { loc.pl_col = loc.pl_new_col; return FILE_MORE; } loc.pl_line = loc.pl_new_line; loc.pl_col = loc.pl_new_col; } return FILE_MORE; } /* text_onepage */ static char * #ifndef KANJI mp_get_text(infile, locp, asheet) #else mp_get_text(infile, locp, asheet, kp) int *kp; #endif FILE *infile; struct pageloc *locp; struct sheet *asheet; { int gathering; int tabcnt; int ichr; static int prevchar = 0; char *textp; #ifdef KANJI static int prevkanj = 0; #endif textp = text; locp->pl_new_line = locp->pl_line; locp->pl_new_col = locp->pl_col; #ifdef KANJI *kp = -1; #endif gathering = 1; /* * Make sure there is still enough space in text array (we * may need to put 5 characters plus NULL in it. */ while (gathering && textp - text < LINESIZE - 5) { if (use_utf8) { int c, i; size_t len; char uni[7]; #ifdef KANJI *kp = 0; #endif if (prevchar) { c = prevchar; prevchar = 0; } else c = fgetc (infile); if (c < 128) len = 1; else if ((c & 0xe0) == 0xc0) len = 2; else if ((c & 0xf0) == 0xe0) len = 3; else if ((c & 0xf8) == 0xf0) len = 4; else if ((c & 0xfc) == 0xf8) len = 5; else if ((c & 0xfe) == 0xfc) len = 6; else { fprintf (stderr, "Invalid UTF-8\n"); len = 1; } if (len > 1) { uni[0] = c; for (i = 1; i < len; i++) { c = fgetc (infile); if ((c & 0xc0) != 0x80) { fprintf (stderr, "Invalid UTF-8\n"); break; } uni[i] = c; } uni[i] = 0; /* FIXME: need to decide a width of glyph */ locp->pl_new_col += 2; for (i = 0; uni[i]; i++) *textp++ = uni[i]; continue; } else { ichr = c; } } else { #ifdef KANJI if (current_locale && !strncmp(current_locale,"ja_JP",5)) { if (prevkanj) { *kp = prevkanj; if (prevkanj >= 0x0100) locp->pl_new_col++; locp->pl_new_col++; prevkanj = 0; gathering = 0; return textp; } if (prevchar) { ichr = prevchar; prevchar = 0; } else ichr = get_wc( infile ); if (ichr >= 0x0080) { if (*kp < 0) { *kp = ichr; gathering = 0; if (ichr >= 0x0100) locp->pl_new_col++; locp->pl_new_col++; if (opt_fold && (locp->pl_new_col >= asheet->sh_cwidth)) { gathering = 1; locp->pl_new_line += 1; locp->pl_new_col = opt_indent; } return textp; } else { prevkanj = ichr; gathering = 0; goto loopend; } } else *kp = 0; } else { *kp = 0; prevkanj = 0; #endif if (prevchar) { ichr = prevchar; prevchar = 0; } else ichr = fgetc(infile); #ifdef KANJI } #endif } Debug(DB_GETLINE, "%%called fgetc ichr = %d", ichr); /* * this prevents nulls in the input from confusing the * program logic with truncated strings */ if (ichr == 0) { ichr = 1; } switch (ichr) { case EOF: Debug(DB_GETLINE, "(%d)\n", EOF); gathering = 0; if (text == textp) return 0; break; case '\n': locp->pl_new_line++; locp->pl_new_col = opt_indent; gathering = 0; break; case '\r': locp->pl_new_col = opt_indent; gathering = 0; break; case '\b': if (--locp->pl_new_col < opt_indent) { locp->pl_new_col = opt_indent; } gathering = 0; break; case '\f': locp->pl_new_line = -1; gathering = 0; /* * Ignore newline in "\f\n" sequence */ prevchar = fgetc(infile); if (prevchar == '\n') { prevchar = 0; } break; case '\t': tabcnt = opt_tabstop - ((locp->pl_new_col - opt_indent) % opt_tabstop); locp->pl_new_col += tabcnt; gathering = 0; break; /* * case ' ': * locp->pl_new_col++; * gathering = 0; * break; */ default: /* keep on gathering if it fits on the line ... */ if (opt_fold && (locp->pl_new_col >= asheet->sh_cwidth)) { prevchar = ichr; gathering = 0; locp->pl_new_line++; locp->pl_new_col = opt_indent; break; } if (ichr == ')' || ichr == '(' || ichr == '\\') { *textp++ = '\\'; *textp++ = ichr; } /* else if (ichr >= ' ' && ichr <= '~') */ else if (ichr >= first_encoding && ichr <= last_encoding) *textp++ = ichr; else { *textp++ = '\\'; *textp++ = '2'; *textp++ = '7'; *textp++ = '7'; } locp->pl_new_col++; break; } } #ifdef KANJI loopend: *kp = 0; #endif *textp = 0; /* * remove any spaces at the front of the text string by * "converting" it to a position change */ textp = text; while (*textp && *textp == ' ') { /* * this affects the starting position of this text string * (not the next) */ locp->pl_col++; textp++; } return textp; } /* mp_get_text */ #ifdef KANJI #define ESC 0x1b unsigned short sjtojis(unsigned short, unsigned short); int issjkanji(int ); #define UNKOWN 0 #define SJIS 1 #define EUC 2 int get_wc( FILE *infile ) { static int ext[3]; static unsigned int rem = 0; static int in_kanji = 0; static int coding = UNKOWN; int c; if (!rem) { while(1) { c = fgetc(infile); ext[rem++] = c; if (c == EOF) break; if (ext[0] == ESC) { if (rem >= 3) { if (ext[1] == '$' /*&& ext[2] == 'B' */) in_kanji = 1; else if (ext[1] == '(' /*&& ext[2] == 'B' */) in_kanji = 0; else goto loopout; rem = 0; continue; } } else { if (in_kanji) { if (rem >= 2) { rem = 0; return (ext[0]<<8) + ext[1]; } } else if (coding != SJIS && c >= 0xa1 && c <= 0xf4) { /* EUC */ rem = 0; coding = EUC; return ((c & 0x7f) << 8) + (fgetc(infile) & 0x7f); } else if (issjkanji(c)) { rem = 0; if (coding != EUC) coding = SJIS; return sjtojis(c, fgetc(infile)); } else goto loopout; } } } loopout: if (rem) { c = ext[0]; ext[0] = ext[1]; ext[1] = ext[2]; rem--; } return c; } /* get_wc */ int issjkanji(int c) { c &= 0377; return ((c > 0x80 && c < 0xa0) || (c > 0xdf && c < 0xfd)); } /* issjkanji */ #ifdef JIS7 iskana(int c) { c &= 0xff; return ((c >= 0xa0) && (c <= df)); } /* iskana */ #endif unsigned short sjtojis(unsigned short byte1, unsigned short byte2) { unsigned short c; byte1 -= (byte1 >= 0xa0) ? 0xc1 : 0x81; c = ((byte1 << 1) + 0x21) << 8; if (byte2 >= 0x9f) { c += 0x0100; c |= (byte2 - 0x7e) & 0xff; } else { c |= (byte2 - ((byte2<=0x7e) ? 0x1f : 0x20)) & 0xff; } return (c); } /* sjtojis */ #endif ./mpage-2.5.6/CHANGES0000644002342000001440000003677010741127715013147 0ustar marcelusers Januari 2008 - Released version 2.5.6 - honour /etc/papersize file November 2006 - Released version 2.5.5 - apply Fedora restricted font and scale patches September 2005 - usage fixes - use /tmp instead of /usr/tmp - Duplex featrure settings go into %%BeginSetup section. November 2004 - Small updates to manual page May 2004 - Released version 2.5.4 - Do not explicitely switch of duplex mode when -t is not given. - Add redhat utf-8 patch - Add -u option to switch off utf-8 checking August 2003 RedHat fixes - check for empy optarg in arg processing. Suggested by J.D. Laub : - -V option to show mpage version - -- option to stop process options (remaing args are files) - add -- option to prprog when filename starts with a -. From: Sanjoy Mahajan - %% and \n fixes for Duplex Beginfeature settings. October 2002 - Released version 2.5.3 - Start moving mapge into the GPL... - Fixed double 'showsheet' output when processing postscript. - Added A0 to page_desc in glob.c. - Remove newline after formfeed. (Gregory Bond ) - the -X option now always prints the filename/header on the left and the physical page number on the right. Per suggestion of Marc Branchaud - From Neil Brown : define showheet using the load operator instead of the bind operator. This might solve situations where showpage is redefined elsewhere. - From Ilgiz Latypov : -J option to set an initial value to the pagenum counter. - Improved processing of "BeginDocument/EndDocument" directives resulting in much better handling of included EPS graphics. Should improve processing of dvips files a lot... Jun 2002 from: jdl@access-health.com - When processing stdin, 'pr' was hardcoded instead of using the prprog variable. - Removed useless strcpy when processing command line args (could even give unpredictable results) from: dlarson@brookings.net - explicitely set duplex printing to false in the default case. from: George.Pajari@Faximum.com - using -m while printing in duplex creates useless margins: punching holes may go through the printed areas on one of the sides. Jan 2002 Marcel J.E. Mol marcel@mesa.nl - lib/mpage -> share/mpage Nov 2001 Marcel J.E. Mol marcel@mesa.nl - Changes from redhat * use mkstemp instead of mktemp. * kanji support. Oct 2000 Marcel J.E. Mol marcel@mesa.nl - Added A1 and A2 to page_desc in glob.c. Aug 1999 Marcel J.E. Mol marcel@mesa.nl - Added -e option and related code from Enrique Melendez Asensio to allow 4,1,2,3 booklets... Needs cleanup and extended to txt too. - Patch from Gabor Ribarik to take of dvips(k) 5.78's output if it contains many postscript figures. (see indoc variable in post.c) He (or actually Attila Karpati) also implemented multiple -j options. Fix the %%Page director when pages are skipped (with -j). - Include amiga port from Andreas R. Kleinert : * added smakefile, smakefile.ppc and SCOPTIONS * added #ifdef AMIGA section to mpage.h * mpage.h now #undefs MAXINT if already #define (before re-#defining it iself) * LIBDIR has been #define within SCOPTIONS; used MPAGE: assign, which you may redirect yourself, then... Jun 1998 Marcel J.E. Mol marcel@mesa.nl - Clipping logical page was terribly wrong. This was visible when specifying negative pagemargins (-M). Apr 1998 Marcel J.E. Mol marcel@mesa.nl - Corrected types (lvirden@cas.org) Mar 1998 Marcel J.E. Mol marcel@mesa.nl - for EPS files that have %%Trailer and are included in PS files mpage will stop after the first %%Trailer. Made check on %%Trailer (and %%PSTrailer) a runtime option -k ('kill on trailer'); - When input text file has no newline at last line, mpage forgot to print that line... - Updated manual page and usage (lm@cs.rmit.edu.au) - warning in -b option failed. - Changed defining paper types (to add new papger tpyes, just add to the paper array in glob.c). Jan 1998 Marcel J.E. Mol marcel@mesa.nl - Removed save/restore statements for PS input processing. They seem to generate 'memory overflow' errors. - Removed 'TexDict begin' additions for dvips files. - OS/2 changes (Alexander Mai ) - Makefile: create install dirs if not there (jwessel@uiuc.edu) - Check for %PSTrailer (for Mathematis program) (jwessel@uiuc.edu) - version 2.5 introduced bug in handling formfeed in text files. Fixed. Nov 1997 Marcel J.E. Mol marcel@mesa.nl - Released version 2.5 - Small hack to improve dvips handling. Hope this solves a few of the problems... - Check on EOF for netscape output. (thanks ppomes@Qualcomm.com) - -o -H showed darker outline instead of no outline at all! (noted by jburt@nass.usda.gov) - Added support for A3 paper size (thanks ) - Included mergeps.l and mergeps.txt from . Feb 1997 Marcel J.E. Mol marcel@mesa.nl - Added "%%BeginProlog" to output... Dec 1996 Marcel J.E. Mol marcel@mesa.nl - Fixed possible bufferoverflow in text.c in array text. Sep 1996 Marcel J.E. Mol marcel@mesa.nl Version 2.4 - Set PS id string to level 2 instead of 1. Hope this is ok... - Added -b option to select paper type. Option string is case insensitive. Now -A and -U option may be removed, they are not mentioned in the usage() anymore, but are in the man page. - Added support for Legal paper size: option -bLegal May 1996 Marcel J.E. Mol marcel@mesa.nl - Try detecting dvi2ps files: scan %%Title on .dvi. The catch the TeXDict to to init the PS state , bescause it interferes with mpage setup. TeXDict will be called internally for each page. This setup seems to work for plain TeX text, but figures seem to have mind of their own and do not scale... - -X option accepts an optional argument that is used for physical pageheader, instead of current filename + physical page number. The argument is centered on the pageheader. April 1996 Marcel J.E. Mol marcel@mesa.nl Version 2.3b - Included OS/2 port based on code from Tilmann Boess . See README.OS2. I cannot test on OS/2 so the merge of the Makefile might be wrong... March 1996 Marcel J.E. Mol marcel@mesa.nl Version 2.3a - Some compilers cannot process strings running on multiple lines (AIX) - Remove any leading ctrl-d characters from the input file. Some postscript files (micros*ft) start with it. Hope this is no problem on text files starting with ctrl-d's (suggested by Eric Lammerts ) Changes based on diffs by: mingso@netcom.com (Ming Yau So) - Added -s option to set the tabstops. - Added compile time option to set spooler type. - Adjusted usage to display printer settings etc Februari 1996 Marcel J.E. Mol marcel@mesa.nl Version 2.3 - Changed semantics of -C option. With subargument it takes it as a character encoding name to use (needs a file from $LIBDIR/mpage). Without subargument it toggles the usage of encoding. An internal default encoding is added to the code. Suggested by Jens Poenisch - Removed all the RCS stuff as I don't use it. - Added -R option: print pages left to right, bottom to top. Suggested by vilhuber@cs.colorado.edu. - Add -X option to print a header on each physical page. Currently just the filename and the physical page number. Changes based on suggestions by Björn Torkelsson : - Made -t a toggle instead of forcing duplex mode. - Add -D option to specify a strftime date format to be used in printing in page headers. - Add -T option to tumble every second pages in duplex mode. November 1995 Marcel J.E. Mol marcel@mesa.nl Version 2.2.2 - Added -d option to force certain input file type. Currently only -da and -dp exist to force ascii or postscript input. -dp probably is not useful or does not work as you might expect, so this is not mentioned in the usage page... manual page not updated yet... September 1995 Marcel J.E. Mol marcel@duteca.et.tudelft.nl - Hm, version numbering is a bit odd. Gues gonna call this 2.2.1 - Option -P without argument send output to stdout instead of default printer. Fixed, thanks Patrik Hagglund and Martin Kraemer - Added -B option to draw a box around certain text, by E. Robert Tisdale May 1995 Marcel J.E. Mol marcel@duteca.et.tudelft.nl Version 2.2 Processing postcript files is much better now... - Included several user contributions, see below. - Recursive mpage usage seems to work now... - ditriff output seems to work again... - xv postscript output seems to work (at least xv 3.1) - Added -O and -E options, contributed by Grigor Pavlov Nikolov December 1994 Jan Kasprzak Created Encodings/ISO-Latin.2 file. December 1994 Jonathan Ross - Some systems need string.h in mpage.c - removed some non-ansi preprocessor usages (i.e. #endif DEBUG) - fixed description for -P December 1994 Ron van den Burg (burg1@ksla.nl). Produced a better description of the changes between 2.13 and 2.14 version 2.13 defaults: mpage -4onuvA version 2.14 defaults: Disappeared: -b use -o to toggle between b(lank) and o(utlines) -n use -l to toggle between n(ormal) and l(andscape) -s use -v to toggle between s(ilent) mode and v(erbose) -u use -a to toggle between u(pdown) and leftright New: -H Create header line -Cencodingfile Specify then character encoding file. Default is none. The should be in the mpage library directory (/usr/local/lib/mpage). -Ffontname Specify font. Default is Courier. -t Print on both sides of the paper. This will enable duplex mode of the printer. Use this option only if your printer is capable of printing in duplex mode. (default off). -zprintcommand Specify command to use to send output to. Default is lpr . You can specify command line options, but see -Z option. For example -zlp for system V Unix. -Zprintprog_queuename_arg Specify what option to use for the "-z printcommand" to specify a printqueue. For example -zlp -Z-d for system V Unix. Changed: -c Is a toggle now. -o Is a toggle now. Makes -b obsolete. -v Is a toggle now. Makes -s obsolete. -l Is a toggle now. Makes -n obsolete. -f Is a toggle now. -a Is a toggle now. Makes -u obsolete. november 1994 Marcel J.E. Mol Version 2.14 Added -z and -Z option to set the print command and its queuename argument (defaults to lpr and -P). Send out to the world... august/september94 Marcel J.E. Mol Included old patch to allow ISO characters: - [ Aug 1992 at@cc.tut.fi ] ISO-modifications. Conforms to standards ISO-216 (provided that it really is the same as SFS EN 20216) and ISO-8859.1, (provided that the table these were taken was 8859.1-conforming). Does not break 8-bit characters any more (because it prints them). [ ISO-216 defines A4-sized paper and ISO-8859.1 8-bit character set which includes many useful national characters used in European languages ] Modified ISO code: character encoding table is read from file, specified by -C option. The default encoding is Courier without 8-bit support. (see Postscript reference manual, appendix E?) Check on 'doprint' instead of '*printer' for closing outfd. Suggested by byrnes@ee.cornell.edu to fix core dunps on their old VAX. Removed all mp_ prefix from source files. Deleted RCS subtree. Added %%Orientation and %%DocumentMedia in postscript comments (looks good when viewing output with ghostview). Removed unecessary array declarations and variables. Added -F option to specify other than default Courier font. Specifying "-P-" turns of 'printing' as specified by an MPAGE environment variable. july94 Marcel J.E. Mol Get rid of changing source when someone want US letter as default paper size or A4: Now it is settable in Makefile. In version 2.13 pagemargin_xxx processing on postscript input was gone. Should work again now. july94 Sisira Jayasinghe implemented -t option to print in duplex mode. Spell checked the man page. Made US letter size paper to be default. may/june94 Marcel J.E. Mol Version 2.13 Changed processing of pagemargin_xxx so that the -H option could be implemented. -H option: let mpage print page headers in a different font. This way no 'pr' processing is needed. Added function declarations to mp_head.h so that gcc -Wall does not complain so much anymore. may94 Marcel J.E. Mol Implemented -a, -c, -f, -l, -o and -v options as toggles -> remove -s, -b, -n and -u options. -c option: do not start each file on a new page. -m option can now specify all four margins seperately (iWith help from Frank ten Wolde ) New option -M to specify all four margins inside logical pages. Printing MS-Windows postscript files with mpage *might* work now... "xx pages printed" message brought under -v option. oct93-mar94 Marcel J.E. Mol Bump version to 2.12 and send out ... Added -I option: indent text. Fixed bug in fold option, when an escaped char is at the end of a line ... Fixed bug when readne '/r' Added -m (set page margin) and -f (fold long lines) options. Changed -p (allow to give a 'pr' command string) and -P (defaults to default printer) options. ... Many changes have been made between Version 1 and Version 2: - *BIGGIE* Printing of backspaces, overwrites, formfeeds and other text is greatly improved. I changed the whole way text was processed and the code went from 3 unreadable pages to one very readable page. It is amazing what the right approch can do. - *ANOTHER BIGGIE* PostScript documents can now be printed. Most conforming will be properly printed, multple pages per sheet. There is still clean up to do here, but it seems to work. I think that when I hit upon the right paradigm for this, it will clean up just like the text processing code did. (XRef: TODO) - Outlines are now optional. If you like to see them (as I do) put the "-o" option in your MPAGE environment variable. - Added recognition of the PRINTER and MPAGE environment variables. - Added the beginnings of support the European A4 paper. (The method should be extended to legal sized paper.) Credit goes to Michael Fingerhut, System Manager, IRCAM Paris (France), (...!uunet!ircam!mf) for the inspiration for the proper way to do this. - MPage now prints a message stating how many pages (sheets) were created and to which printer it was spooled. - Stuffed the sources under RCS to keep track of changes. * Revision 1.1 89/05/22 14:19:56 mark * Initial revision ./mpage-2.5.6/Characters0000644002342000001440000000626105632416667014160 0ustar marcelusers%%%% postscript characters not in Standard or ISO-Latin-1 sets /??? /Scaron /??? /Ydieresis /??? /Zcaron /??? /scaron /??? /trademark /??? /zcaron %%%% postscript characters in the ISO-Latin-1 set /040 /space /041 /exclam /042 /quotedbl /043 /numbersign /044 /dollar /045 /percent /046 /ampersand /047 /quoteright /050 /parenleft /051 /parenright /052 /asterisk /053 /plus /054 /comma /055 /minus /056 /period /057 /slash /060 /zero /061 /one /062 /two /063 /three /064 /four /065 /five /066 /six /067 /seven /070 /eight /071 /nine /072 /colon /073 /semicolon /074 /less /075 /equal /076 /greater /077 /question /100 /at /101 /A /102 /B /103 /C /104 /D /105 /E /106 /F /107 /G /110 /H /111 /I /112 /J /113 /K /114 /L /115 /M /116 /N /117 /O /120 /P /121 /Q /122 /R /123 /S /124 /T /125 /U /126 /V /127 /W /130 /X /131 /Y /132 /Z /133 /bracketleft /134 /backslash /135 /bracketright /136 /asciicircum /137 /underscore /140 /quoteleft /141 /a /142 /b /143 /c /144 /d /145 /e /146 /f /147 /g /150 /h /151 /i /152 /j /153 /k /154 /l /155 /m /156 /n /157 /o /160 /p /161 /q /162 /r /163 /s /164 /t /165 /u /166 /v /167 /w /170 /x /171 /y /172 /z /173 /braceleft /174 /bar /175 /braceright /176 /asciitilde 177 200 201 202 203 204 205 206 207 210 211 212 213 214 215 216 217 /220 /dotlessi /221 /grave /222 /acute /223 /circumflex /224 /tilde /226 /breve /227 /dotaccent 230 231 /232 /ring 233 234 /235 /hungarumlaut /236 /ogonek /237 /caron 240 /241 /exclamdown /242 /cent /243 /sterling /244 /currency /245 /yen /246 /brokenbar /247 /section /250 /dieresis /251 /copyright /252 /ordfeminine /253 /guillemotleft /254 /logicalnot /255 /hyphen /256 /registered /257 /macron /260 /degree /261 /plusminus /262 /twosuperior /263 /threesuperior /264 /acute /265 /mu /266 /paragraph /267 /periodcentered /270 /cedilla /271 /onesuperior /272 /ordmasculine /273 /guillemotright /274 /onequarter /275 /onehalf /276 /threequarters /277 /questiondown /300 /Agrave /301 /Aacute /302 /Acircumflex /303 /Atilde /304 /Adieresis /305 /Aring /306 /AE /307 /Ccedilla /310 /Egrave /311 /Eacute /312 /Ecircumflex /313 /Edieresis /314 /Igrave /315 /Iacute /316 /Icircumflex /317 /Idieresis /320 /Eth /321 /Ntilde /322 /Ograve /323 /Oacute /324 /Ocircumflex /325 /Otilde /326 /Odieresis /327 /multiply /330 /Oslash /331 /Ugrave /332 /Uacute /333 /Ucircumflex /334 /Udieresis /335 /Yacute /336 /Thorn /337 /germandbls /340 /agrave /341 /aacute /342 /acircumflex /343 /atilde /344 /adieresis /345 /aring /346 /ae /347 /ccedilla /350 /egrave /351 /eacute /352 /ecircumflex /353 /edieresis /354 /igrave /355 /iacute /356 /icircumflex /357 /idieresis /360 /eth /361 /ntilde /362 /ograve /363 /oacute /364 /ocircumflex /365 /otilde /366 /odieresis /367 /divide /370 /oslash /371 /ugrave /372 /uacute /373 /ucircumflex /374 /udieresis /375 /yacute /376 /thorn /377 /ydieresis %%%% postscript characters in the the standard but not in the ISO-Latin-1 set /244 /fraction /246 /florin /251 /quotesingle /252 /quotedblleft /254 /guilsinglleft /255 /guilsinglright /256 /fi /257 /fl /261 /endash /262 /dagger /263 /daggerdbl /267 /bullet /270 /quotesinglbase /271 /quotedblbase /272 /quotedblright /274 /ellipsis /275 /perthousend /320 /emdash /350 /Lslash /352 /OE /370 /lslash /372 /oe ./mpage-2.5.6/Makefile0000644002342000001440000001146410056434067013605 0ustar marcelusers# # mpage: A program to reduce pages of print so that several pages # of output appear on one sheet of paper. # # Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands # Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia # # Permission is granted to anyone to make or distribute verbatim # copies of this document as received, in any medium, provided # that this copyright notice is preserved, and that the # distributor grants the recipient permission for further # redistribution as permitted by this notice. # # Marcel Mol MESA Consulting # P.o. box 112 # 2630 AC Nootdorp # The Netherlands # phone: +31-6-54724868 # marcel@mesa.nl info@mesa.nl # http://www.mesa.nl/pub/mpage # ftp://ftp.mesa.nl/pub/mpage # # Set this to an ANSI compatible C compiler (preferably gcc) # See also system specific settings below #CC=cc CC=gcc ############################################################################ # # MPAGE Configuration # ############################################################################ # # Define your favorite page size: # Letter for US letter # Legal for legal # A4 for European A4 # See glob.c for all possibilities # # PAGESIZE=Letter PAGESIZE=A4 # # Define your spooler type # ATT_SPOOLER for 'lp ...' type printing # BSD_SPOOLER for 'lpr ..' tpye printing # SPOOL_TYPE=BSD_SPOOLER # PREFIX=e:/usr # OS/2 type PREFIX=/usr/local #PREFIX=/usr BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/share MANDIR=$(PREFIX)/man/man1 # # A default encoding is given in encoding.h. Setting ENCODING=1 will # activate this encoding by default. 0 switches default off. # The -C option (without subargument) can be used to switch. # ENCODING=1 # # Set the default sheet margin in 1/72 inches. # SHEETMARGIN=18 # # Set intial duplex mode # DEFAULT_DUPLEX=0 DEFS = -DPAGE_DEF=\"${PAGESIZE}\" -DLIBDIR=\"${LIBDIR}/mpage\" -DDEFAULT_ENCODING=${ENCODING} -DDEFAULT_DUPLEX=${DEFAULT_DUPLEX} -DDEFAULTSMARGIN=${SHEETMARGIN} -DSPOOLER=${SPOOL_TYPE} # -DKANJI ############################################################################ # # OPERATING SYSTEM SETUP # ############################################################################ # Unix extensions E = O = .o # OS/2: # CFLAGS = -O2 $(DEFS) -Wall # LIBS = -Zcrtdll -s # DEF_FILE = mpage.defM # E = .exe # O = .o # MSDOS extensions # E = .exe # O = .obj ############################################################################ # # UNIXEN SPECIFICS # ############################################################################ # Choose one of the following CFLAGS/CC definitions: # If you are using gcc, you probably don't need to change anything here. # Linux: CFLAGS = -O2 -s $(DEFS) -Wall # AIX (xlC on aix 4): #CFLAGS = -O2 -s $(DEFS) # SunOS 4.1.3_U1 1 sun4m (gcc 2.7.2) #CFLAGS = -O2 -s $(DEFS) -D__USE_FIXED_PROTOTYPES__ -Wall # SunOS 4.1.3_U1 1 sun4m (standard C-compiler (NOTE: sample.c will not # compile, since the standard cc is not ANSI-standard) #CFLAGS = -O2 -s $(DEFS) # HP-UX A.09.01 A 9000/735 (standard cc) #CFLAGS = -Aa +O3 -s $(DEFS) -D_INCLUDE_POSIX_SOURCE -Wall # BeOS #CFLAGS= -O2 $(DEFS) # OS X (10.2.2): #CFLAGS = -O2 $(DEFS) -Wall ############################################################################ # # END OF CONFIGURATION OPTIONS # # pattern rules. Should we define these? %$(O): %.c $(CC) $(CFLAGS) -c -o $@ $< HEAD = mpage.h DENC = encoding.h SRCS = mpage.c glob.c text.c post.c file.c page.c args.c util.c MOBJ = mpage$(O) glob$(O) text$(O) post$(O) file$(O) page$(O) args$(O) util$(O) SMPL = sample.c page.c glob.c args.c SOBJ = sample$(O) page$(O) glob$(O) args$(O) default: mpage$(E) msample$(E) mpage.1 @echo Done! mpage$(E): $(MOBJ) $(CC) $(CFLAGS) -o mpage$(E) $(MOBJ) $(LIBS) msample$(E): $(SOBJ) $(CC) $(CFLAGS) -o msample$(E) $(SOBJ) $(LIBS) mpage.1: mpage.1.in sed 's:PREFIX:${PREFIX}:' < mpage.1.in > mpage.1 clean: rm -rf $(MOBJ) mpage$(E) mpage.ps $(SOBJ) msample$(E) mpage.1 make.log core mpage$(O): $(HEAD) $(DENC) mpage.c glob$(O): $(HEAD) glob.c text$(O): $(HEAD) text.c post$(O): $(HEAD) post.c file$(O): $(HEAD) file.c page$(O): $(HEAD) page.c args$(O): $(HEAD) args.c util$(O): $(HEAD) util.c sample$(O): $(HEAD) sample.c mpage.ps: mpage.1 psroff -t -man mpage.1 > mpage.ps # # add your proper install stuff # install: if [ ! -d $(LIBDIR)/mpage ] ; then mkdir -p $(LIBDIR)/mpage ; fi if [ ! -d $(BINDIR) ] ; then mkdir -p $(BINDIR) ; fi if [ ! -d $(MANDIR) ] ; then mkdir -p $(MANDIR) ; fi cp mpage$(E) $(BINDIR) cp mpage.1 $(MANDIR) -cp Encodings/* $(LIBDIR)/mpage -chmod 644 $(LIBDIR)/mpage/* ./mpage-2.5.6/README0000644002342000001440000001350110056435217013015 0ustar marcelusers COPYRIGHT: Mpage and all the files distributed with mpage are covered by copyright: Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that this copyright notice is preserved, and that the distributor grants the recipient permission for further redistribution as permitted by this notice. marcel@mesa.nl MESA Consulting B.V. Nootdorp The Netherlands Phone: +31-15-3105252 Mobile:+31-6-54724868 Fax: +31-15-3105253 email: info@mesa.nl http://www.mesa.nl ftp://ftp.mesa.nl ================================================================= DESCRIPTION: Mpage is a program to reduce and print multiple pages of text per sheet on a PostScript compatible printer. It also has limited functionality to do the same directly with postscript files. The following are the files you should have for mpage. README Notes and descriptions, this file README.OS2 OS/2 port description Copyright Copyright notice CHANGES Change history Makefile The Makefile TODO Wish List for changes FAQ Useful tips and hints NEWS Global changes, User visible changes Mpage.lsm LSM file for mpage args.c Command line and options processing encoding.h Definition of internal default character encoding encoding.h.CP850 Popular for renaming to encoding.h file.c Generic file handling glob.c Global variable setup mpage.h Definitions mpage.c Main Control page.c Page layout routines post.c PostScript file processing sample.c Prints sample page layout pages text.c Text file processing util.c Misc utility functions mpage.1 Manual page All.chars Test file containing all ASCII characters Encodings Directory with character encoding library files Characters List of Postscript character encoding names Encoding.format Description on how to create character encoding library files gencodes.c Util program to build All.chars file Test Directory with test pages OS2 Directory with simulated lpr for OS/2 Contrib Directory with contributions by others Contrib/mfix Fix to mpage that makes it work with ArborText INSTRUCTIONS: All you should need to do is run make. Actually it is probably better to have a look at the Makefile and to check settings like for example PAGESIZE to set the default page size (e.g A4 or Letter ...). This will create the programs mpage and msample. Mpage is the program to print n-up pages. Msample prints a sample outline. I used it for debugging the placement of the layout. It is also handy for other layout purposes. It accepts all the arguments that mpage does, but does not print files. As a quick sample try: "mpage mp_args.c" or "mpage -8 mp_post.c" or "groff -man mpage.1 | mpage -2" The manual page, mpage.1, formats with UCB or ATT manual macros. USING MPAGE: You will find that it takes a while on an Apple LW or Apple LW+ to print 4 pages per sheet, It takes "a good long time" for 8 pages. Reduced PostScript documents take a while too. (A rule of thumb might be 4 times as long for 4-pages-per-sheet reduction :-) On a QMS 8ppm printer 4 pages per sheet is about the same speed and other forms of "1-up" output. mpage prints some timing information back from the printer so you can measure the time required for full jobs. ADMINISTRATORS: As a printer administrator you should see the wish list for caveats and information about future versions. I still have work to do to make mpage more "administrator friendly", but figured that I'd better get what's been done out the door. BUG REPORTS: Mpage is supported but this is done in spare time. So please send in bug reports, requests or other things related to mpage and once in a while I'll release a version... If you have a problem please send me a complete description of the symptoms. Please include the brand name of your printer, a copy of the input file (especially if it is with PostScript input), and a description of what to look for on the output. If your printer has an error log, please include as much of it as is revalant. In general, the more clearly organized information I have, the easier it will be for me. And please do not forget to mention the mpage version you're using. Also the output generated by your mpage might come in handy... MAKING CHANGES: Please, if you make any improvements, send them back to me so that I can include them in future versions. Also I would solicit comments as to the usefulness, and effectiveness of mpage. Let me know what you like or dislike and feel free to ask any questions you have concerning this mpage distribution. Thank you! -Marcel Mol ------------------------------------------------------------------------------ Marcel J.E. Mol phone: (+31) 015-3105252 ------------------------------------------------------------------------------ | MESA Consulting BV | Networking and Unix Consultancy | marcel@mesa.nl ------------------------------------------------------------------------------ They couldn't think of a number, so they gave me a name! -- Rupert Hine ./mpage-2.5.6/Encodings/0000755002342000001440000000000007335731160014050 5ustar marcelusers./mpage-2.5.6/Encodings/ISO+STD+OTH0000644002342000001440000000550405632414534015506 0ustar marcelusers%%%% ISO-Latin.1 encoding plus Standaard plus other postscript encodings in the undefined entries 26 255 % first and last encoding 026 /Scaron 027 /Ydieresis 028 /Zcaron 029 /scaron 030 /trademark 031 /zcaron 032 /space 033 /exclam 034 /quotedbl 035 /numbersign 036 /dollar 037 /percent 038 /ampersand 039 /quoteright 040 /parenleft 041 /parenright 042 /asterisk 043 /plus 044 /comma 045 /minus 046 /period 047 /slash 048 /zero 049 /one 050 /two 051 /three 052 /four 053 /five 054 /six 055 /seven 056 /eight 057 /nine 058 /colon 059 /semicolon 060 /less 061 /equal 062 /greater 063 /question 064 /at 065 /A 066 /B 067 /C 068 /D 069 /E 070 /F 071 /G 072 /H 073 /I 074 /J 075 /K 076 /L 077 /M 078 /N 079 /O 080 /P 081 /Q 082 /R 083 /S 084 /T 085 /U 086 /V 087 /W 088 /X 089 /Y 090 /Z 091 /bracketleft 092 /backslash 093 /bracketright 094 /asciicircum 095 /underscore 096 /quoteleft 097 /a 098 /b 099 /c 100 /d 101 /e 102 /f 103 /g 104 /h 105 /i 106 /j 107 /k 108 /l 109 /m 110 /n 111 /o 112 /p 113 /q 114 /r 115 /s 116 /t 117 /u 118 /v 119 /w 120 /x 121 /y 122 /z 123 /braceleft 124 /bar 125 /braceright 126 /asciitilde 127 /.notdef 128 /fraction 129 /florin 130 /quotesingle 131 /quotedblleft 132 /guilsinglleft 133 /guilsinglright 134 /fi 135 /fl 136 /endash 137 /dagger 138 /daggerdbl 139 /bullet 140 /quotesinglbase 141 /quotedblbase 142 /quotedblright 143 /ellipsis 144 /dotlessi 145 /grave 146 /acute 147 /circumflex 148 /tilde 149 /oe 150 /breve 151 /dotaccent 152 /perthousand 153 /emdash 154 /ring 155 /Lslash 156 /OE 157 /hungarumlaut 158 /ogonek 159 /caron 160 /lslash 161 /exclamdown 162 /cent 163 /sterling 164 /currency 165 /yen 166 /brokenbar 167 /section 168 /dieresis 169 /copyright 170 /ordfeminine 171 /guillemotleft 172 /logicalnot 173 /hyphen 174 /registered 175 /macron 176 /degree 177 /plusminus 178 /twosuperior 179 /threesuperior 180 /acute 181 /mu 182 /paragraph 183 /periodcentered 184 /cedilla 185 /onesuperior 186 /ordmasculine 187 /guillemotright 188 /onequarter 189 /onehalf 190 /threequarters 191 /questiondown 192 /Agrave 193 /Aacute 194 /Acircumflex 195 /Atilde 196 /Adieresis 197 /Aring 198 /AE 199 /Ccedilla 200 /Egrave 201 /Eacute 202 /Ecircumflex 203 /Edieresis 204 /Igrave 205 /Iacute 206 /Icircumflex 207 /Idieresis 208 /Eth 209 /Ntilde 210 /Ograve 211 /Oacute 212 /Ocircumflex 213 /Otilde 214 /Odieresis 215 /multiply 216 /Oslash 217 /Ugrave 218 /Uacute 219 /Ucircumflex 220 /Udieresis 221 /Yacute 222 /Thorn 223 /germandbls 224 /agrave 225 /aacute 226 /acircumflex 227 /atilde 228 /adieresis 229 /aring 230 /ae 231 /ccedilla 232 /egrave 233 /eacute 234 /ecircumflex 235 /edieresis 236 /igrave 237 /iacute 238 /icircumflex 239 /idieresis 240 /eth 241 /ntilde 242 /ograve 243 /oacute 244 /ocircumflex 245 /otilde 246 /odieresis 247 /divide 248 /oslash 249 /ugrave 250 /uacute 251 /ucircumflex 252 /udieresis 253 /yacute 254 /thorn 255 /ydieresis ./mpage-2.5.6/Encodings/ISO-8859.10000644002342000001440000000541205632411737015204 0ustar marcelusers%%%% ISO-8859.1 character encoding (I think...) 27 255 % first and last encoding 027 /florin 028 /dagger 029 /daggerdbl 030 /perthousand 031 /trademark 032 /space 033 /exclam 034 /quotedbl 035 /numbersign 036 /dollar 037 /percent 038 /ampersand 039 /quoteright 040 /parenleft 041 /parenright 042 /asterisk 043 /plus 044 /comma 045 /hyphen 046 /period 047 /slash 048 /zero 049 /one 050 /two 051 /three 052 /four 053 /five 054 /six 055 /seven 056 /eight 057 /nine 058 /colon 059 /semicolon 060 /less 061 /equal 062 /greater 063 /question 064 /at 065 /A 066 /B 067 /C 068 /D 069 /E 070 /F 071 /G 072 /H 073 /I 074 /J 075 /K 076 /L 077 /M 078 /N 079 /O 080 /P 081 /Q 082 /R 083 /S 084 /T 085 /U 086 /V 087 /W 088 /X 089 /Y 090 /Z 091 /bracketleft 092 /backslash 093 /bracketright 094 /asciicircum 095 /underscore 096 /quoteleft 097 /a 098 /b 099 /c 100 /d 101 /e 102 /f 103 /g 104 /h 105 /i 106 /j 107 /k 108 /l 109 /m 110 /n 111 /o 112 /p 113 /q 114 /r 115 /s 116 /t 117 /u 118 /v 119 /w 120 /x 121 /y 122 /z 123 /braceleft 124 /bar 125 /braceright 126 /asciitilde 127 /.notdef 128 /grave 129 /circumflex 130 /caron 131 /breve 132 /hungarumlaut 133 /cedilla 134 /ogonek 135 /tilde 136 /dotaccent 137 /dotlessi 138 /Lslash 139 /Scaron 140 /Zcaron 141 /OE 142 /fl 143 /fraction 144 /quotesingle 145 /quotedblleft 146 /quotedblbase 147 /quotedblright 148 /guilsinglleft 149 /guilsinglright 150 /endash 151 /emdash 152 /periodcentered 153 /ellipsis 154 /lslash 155 /scaron 156 /zcaron 157 /oe 158 /fi 159 /Ydieresis 160 /.notdef 161 /exclamdown 162 /cent 163 /sterling 164 /currency 165 /yen 166 /brokenbar 167 /section 168 /dieresis 169 /copyright 170 /ordfeminine 171 /guillemotleft 172 /logicalnot 173 /.notdef 174 /registered 175 /macron 176 /ring 177 /plusminus 178 /twosuperior 179 /threesuperior 180 /acute 181 /mu 182 /paragraph 183 /bullet 184 /quotesinglbase 185 /onesuperior 186 /ordmasculine 187 /guillemotright 188 /onequarter 189 /onehalf 190 /threequarters 191 /questiondown 192 /Agrave 193 /Aacute 194 /Acircumflex 195 /Atilde 196 /Adieresis 197 /Aring 198 /AE 199 /Ccedilla 200 /Egrave 201 /Eacute 202 /Ecircumflex 203 /Edieresis 204 /Igrave 205 /Iacute 206 /Icircumflex 207 /Idieresis 208 /Eth 209 /Ntilde 210 /Ograve 211 /Oacute 212 /Ocircumflex 213 /Otilde 214 /Odieresis 215 /multiply 216 /Oslash 217 /Ugrave 218 /Uacute 219 /Ucircumflex 220 /Udieresis 221 /Yacute 222 /Thorn 223 /germandbls 224 /agrave 225 /aacute 226 /acircumflex 227 /atilde 228 /adieresis 229 /aring 230 /ae 231 /ccedilla 232 /egrave 233 /eacute 234 /ecircumflex 235 /edieresis 236 /igrave 237 /iacute 238 /icircumflex 239 /idieresis 240 /eth 241 /ntilde 242 /ograve 243 /oacute 244 /ocircumflex 245 /otilde 246 /odieresis 247 /minus 248 /oslash 249 /ugrave 250 /uacute 251 /ucircumflex 252 /udieresis 253 /yacute 254 /thorn 255 /ydieresis ./mpage-2.5.6/Encodings/ISO-Latin.10000644002342000001440000000524205632414405015632 0ustar marcelusers%%%% ISO-Latin-1 set (I think ...) 32 255 % first and last encoding 032 /space 033 /exclam 034 /quotedbl 035 /numbersign 036 /dollar 037 /percent 038 /ampersand 039 /quoteright 040 /parenleft 041 /parenright 042 /asterisk 043 /plus 044 /comma 045 /minus 046 /period 047 /slash 048 /zero 049 /one 050 /two 051 /three 052 /four 053 /five 054 /six 055 /seven 056 /eight 057 /nine 058 /colon 059 /semicolon 060 /less 061 /equal 062 /greater 063 /question 064 /at 065 /A 066 /B 067 /C 068 /D 069 /E 070 /F 071 /G 072 /H 073 /I 074 /J 075 /K 076 /L 077 /M 078 /N 079 /O 080 /P 081 /Q 082 /R 083 /S 084 /T 085 /U 086 /V 087 /W 088 /X 089 /Y 090 /Z 091 /bracketleft 092 /backslash 093 /bracketright 094 /asciicircum 095 /underscore 096 /quoteleft 097 /a 098 /b 099 /c 100 /d 101 /e 102 /f 103 /g 104 /h 105 /i 106 /j 107 /k 108 /l 109 /m 110 /n 111 /o 112 /p 113 /q 114 /r 115 /s 116 /t 117 /u 118 /v 119 /w 120 /x 121 /y 122 /z 123 /braceleft 124 /bar 125 /braceright 126 /asciitilde 127 /.notdef 128 /.notdef 129 /.notdef 130 /.notdef 131 /.notdef 132 /.notdef 133 /.notdef 134 /.notdef 135 /.notdef 136 /.notdef 137 /.notdef 138 /.notdef 139 /.notdef 140 /.notdef 141 /.notdef 142 /.notdef 143 /.notdef 144 /dotlessi 145 /grave 146 /acute 147 /circumflex 148 /tilde 149 /.notdef 150 /breve 151 /dotaccent 152 /.notdef 153 /.notdef 154 /ring 155 /.notdef 156 /.notdef 157 /hungarumlaut 158 /ogonek 159 /caron 160 /.notdef 161 /exclamdown 162 /cent 163 /sterling 164 /currency 165 /yen 166 /brokenbar 167 /section 168 /dieresis 169 /copyright 170 /ordfeminine 171 /guillemotleft 172 /logicalnot 173 /hyphen 174 /registered 175 /macron 176 /degree 177 /plusminus 178 /twosuperior 179 /threesuperior 180 /acute 181 /mu 182 /paragraph 183 /periodcentered 184 /cedilla 185 /onesuperior 186 /ordmasculine 187 /guillemotright 188 /onequarter 189 /onehalf 190 /threequarters 191 /questiondown 192 /Agrave 193 /Aacute 194 /Acircumflex 195 /Atilde 196 /Adieresis 197 /Aring 198 /AE 199 /Ccedilla 200 /Egrave 201 /Eacute 202 /Ecircumflex 203 /Edieresis 204 /Igrave 205 /Iacute 206 /Icircumflex 207 /Idieresis 208 /Eth 209 /Ntilde 210 /Ograve 211 /Oacute 212 /Ocircumflex 213 /Otilde 214 /Odieresis 215 /multiply 216 /Oslash 217 /Ugrave 218 /Uacute 219 /Ucircumflex 220 /Udieresis 221 /Yacute 222 /Thorn 223 /germandbls 224 /agrave 225 /aacute 226 /acircumflex 227 /atilde 228 /adieresis 229 /aring 230 /ae 231 /ccedilla 232 /egrave 233 /eacute 234 /ecircumflex 235 /edieresis 236 /igrave 237 /iacute 238 /icircumflex 239 /idieresis 240 /eth 241 /ntilde 242 /ograve 243 /oacute 244 /ocircumflex 245 /otilde 246 /odieresis 247 /divide 248 /oslash 249 /ugrave 250 /uacute 251 /ucircumflex 252 /udieresis 253 /yacute 254 /thorn 255 /ydieresis ./mpage-2.5.6/Encodings/ISO-Latin.20000644002342000001440000000725206104236236015635 0ustar marcelusers%%%% ISO-Latin-2 set % % Wed Dec 7 14:43:55 MET 1994 % Written by Jan "Yenya" Kasprzak (kas@foresta.cz, kas@muni.cz) for mpage % filter. ISO Latin 2 (aka iso8859-2) is a character set, used in some % Middle- and East European countries (Czech republic, Slovakia, Poland, % Slovenia, Hungary, and some other -- I don't remember right now). % % You can redistribute this file under the terms of GNU General % Public License (GPL). If you have not your own copy of GPL, % mail me, I will send you one. % -Yenya % % This encoding vector describes real 8859-2 encoding, except of % some little differences: I was not able to find how to name characters, % which have accent shaped as right quote. Instead of these characters % I put there character with caron accent. If you find out how to name % characters with "right quote" accent, mail me. Or you can change it % yourself. You must change the following characters: % % lcaron -> l with right quote, % Lcaron -> L --''-- % tcaron -> L --''-- % dcaron -> L --''-- % % Tcaron and Dcaron are written with a _real_ caron. % 32 255 % first and last encoding 032 /space 033 /exclam 034 /quotedbl 035 /numbersign 036 /dollar 037 /percent 038 /ampersand 039 /quoteright 040 /parenleft 041 /parenright 042 /asterisk 043 /plus 044 /comma 045 /minus 046 /period 047 /slash 048 /zero 049 /one 050 /two 051 /three 052 /four 053 /five 054 /six 055 /seven 056 /eight 057 /nine 058 /colon 059 /semicolon 060 /less 061 /equal 062 /greater 063 /question 064 /at 065 /A 066 /B 067 /C 068 /D 069 /E 070 /F 071 /G 072 /H 073 /I 074 /J 075 /K 076 /L 077 /M 078 /N 079 /O 080 /P 081 /Q 082 /R 083 /S 084 /T 085 /U 086 /V 087 /W 088 /X 089 /Y 090 /Z 091 /bracketleft 092 /backslash 093 /bracketright 094 /asciicircum 095 /underscore 096 /quoteleft 097 /a 098 /b 099 /c 100 /d 101 /e 102 /f 103 /g 104 /h 105 /i 106 /j 107 /k 108 /l 109 /m 110 /n 111 /o 112 /p 113 /q 114 /r 115 /s 116 /t 117 /u 118 /v 119 /w 120 /x 121 /y 122 /z 123 /braceleft 124 /bar 125 /braceright 126 /asciitilde 127 /.notdef 128 /.notdef 129 /.notdef 130 /.notdef 131 /.notdef 132 /.notdef 133 /.notdef 134 /.notdef 135 /.notdef 136 /.notdef 137 /.notdef 138 /.notdef 139 /.notdef 140 /.notdef 141 /.notdef 142 /.notdef 143 /.notdef 144 /dotlessi 145 /grave 146 /acute 147 /circumflex 148 /tilde 149 /.notdef 150 /breve 151 /.notdef 152 /.notdef 153 /.notdef 154 /ring 155 /.notdef 156 /.notdef 157 /hungarumlaut 158 /ogonek 159 /caron 160 /.notdef 161 /Aogonek 162 /breve 163 /Lslash 164 /currency 165 /Lcaron 166 /Sacute 167 /section 168 /dieresis 169 /Scaron 170 /Scedilla 171 /Tcaron 172 /Zacute 173 /hyphen 174 /Zcaron 175 /Zdotaccent 176 /degree 177 /aogonek 178 /ogonek 179 /lslash 180 /acute 181 /lcaron 182 /sacute 183 /circumflex 184 /cedilla 185 /scaron 186 /scedilla 187 /tcaron 188 /zacute 189 /hungarumlaut 190 /zcaron 191 /zdotaccent 192 /Racute 193 /Aacute 194 /Acircumflex 195 /Abreve 196 /Adieresis 197 /Lacute 198 /Cacute 199 /Ccedilla 200 /Ccaron 201 /Eacute 202 /Eogonek 203 /Edieresis 204 /Ecaron 205 /Iacute 206 /Icircumflex 207 /Dcaron 208 /Eth 209 /Nacute 210 /Ncaron 211 /Oacute 212 /Ocircumflex 213 /Ohungarumlaut 214 /Odieresis 215 /multiply 216 /Rcaron 217 /Uring 218 /Uacute 219 /Uhungarumlaut 220 /Udieresis 221 /Yacute 222 /Tcedilla 223 /germandbls 224 /racute 225 /aacute 226 /acircumflex 227 /abreve 228 /adieresis 229 /lacute 230 /cacute 231 /ccedilla 232 /ccaron 233 /eacute 234 /eogonek 235 /edieresis 236 /ecaron 237 /iacute 238 /icircumflex 239 /dcaron 240 /eth 241 /nacute 242 /ncaron 243 /oacute 244 /ocircumflex 245 /ohungarumlaut 246 /odieresis 247 /divide 248 /rcaron 249 /uring 250 /uacute 251 /uhungarumlaut 252 /udieresis 253 /yacute 254 /tcedilla 255 /dotaccent ./mpage-2.5.6/Encodings/CP850.PC0000644002342000001440000000541506131535676015047 0ustar marcelusers%%%% IBM international codepage 850 encoding for mpage filter % % Written by Tilmann Boess , 1996/04/06 % 32 255 % first and last encoding 032 /space 033 /exclam 034 /quotedbl 035 /numbersign 036 /dollar 037 /percent 038 /ampersand 039 /quoteright 040 /parenleft 041 /parenright 042 /asterisk 043 /plus 044 /comma 045 /minus 046 /period 047 /slash 048 /zero 049 /one 050 /two 051 /three 052 /four 053 /five 054 /six 055 /seven 056 /eight 057 /nine 058 /colon 059 /semicolon 060 /less 061 /equal 062 /greater 063 /question 064 /at 065 /A 066 /B 067 /C 068 /D 069 /E 070 /F 071 /G 072 /H 073 /I 074 /J 075 /K 076 /L 077 /M 078 /N 079 /O 080 /P 081 /Q 082 /R 083 /S 084 /T 085 /U 086 /V 087 /W 088 /X 089 /Y 090 /Z 091 /bracketleft 092 /backslash 093 /bracketright 094 /asciicircum 095 /underscore 096 /quoteleft 097 /a 098 /b 099 /c 100 /d 101 /e 102 /f 103 /g 104 /h 105 /i 106 /j 107 /k 108 /l 109 /m 110 /n 111 /o 112 /p 113 /q 114 /r 115 /s 116 /t 117 /u 118 /v 119 /w 120 /x 121 /y 122 /z 123 /braceleft 124 /bar 125 /braceright 126 /asciitilde 127 /.notdef 128 /Ccedilla 129 /udieresis 130 /eacute 131 /acircumflex 132 /adieresis 133 /agrave 134 /aring 135 /ccedilla 136 /ecircumflex 137 /edieresis 138 /egrave 139 /idieresis 140 /icircumflex 141 /igrave 142 /Adieresis 143 /Aring 144 /Eacute 145 /ae 146 /AE 147 /ocircumflex 148 /odieresis 149 /ograve 150 /ucircumflex 151 /ugrave 152 /ydieresis 153 /Odieresis 154 /Udieresis 155 /oslash 156 /sterling 157 /Oslash 158 /multiply 159 /florin 160 /aacute 161 /iacute 162 /oacute 163 /uacute 164 /ntilde 165 /Ntilde 166 /ordfeminine 167 /ordmasculine 168 /questiondown 169 /registered 170 /logicalnot 171 /onehalf 172 /onequarter 173 /exclamdown 174 /guillemotleft 175 /guillemotright 176 /.notdef 177 /.notdef 178 /.notdef 179 /.notdef 180 /.notdef 181 /Aacute 182 /Acircumflex 183 /Agrave 184 /copyright 185 /.notdef 186 /.notdef 187 /.notdef 188 /.notdef 189 /cent 190 /yen 191 /.notdef 192 /.notdef 193 /.notdef 194 /.notdef 195 /.notdef 196 /.notdef 197 /.notdef 198 /atilde 199 /Atilde 200 /.notdef 201 /.notdef 202 /.notdef 203 /.notdef 204 /.notdef 205 /.notdef 206 /.notdef 207 /currency 208 /eth 209 /Eth 210 /Ecirumflex 211 /Edieresis 212 /Egrave 213 /dotlessi 214 /Iacute 215 /Icircumflex 216 /Idieresis 217 /.notdef 218 /.notdef 219 /.notdef 220 /.notdef 221 /brokenbar 222 /Igrave 223 /.notdef 224 /Oacute 225 /germandbls 226 /Ocircumflex 227 /Ograve 228 /otilde 229 /Otilde 230 /mu 231 /thorn 232 /Thorn 233 /Uacute 234 /Ucircumflex 235 /Ugrave 236 /yacute 237 /Yacute 238 /macron 239 /acute 240 /hyphen 241 /plusminus 242 /.notdef 243 /threequarters 244 /paragraph 245 /section 246 /divide 247 /cedilla 248 /degree 249 /dieresis 250 /periodcentered 251 /onesuperior 252 /threesuperior 253 /twosuperior 254 /.notdef 255 /.notdef ./mpage-2.5.6/Encodings/ISO-8859.150000644002342000001440000000544707335731064015301 0ustar marcelusers%%%% ISO-8859.1 character encoding (I think...) %%%% Modified for the ISO-8859.15 (I hope...) ;-) 27 255 % first and last encoding 027 /florin 028 /dagger 029 /daggerdbl 030 /perthousand 031 /trademark 032 /space 033 /exclam 034 /quotedbl 035 /numbersign 036 /dollar 037 /percent 038 /ampersand 039 /quoteright 040 /parenleft 041 /parenright 042 /asterisk 043 /plus 044 /comma 045 /hyphen 046 /period 047 /slash 048 /zero 049 /one 050 /two 051 /three 052 /four 053 /five 054 /six 055 /seven 056 /eight 057 /nine 058 /colon 059 /semicolon 060 /less 061 /equal 062 /greater 063 /question 064 /at 065 /A 066 /B 067 /C 068 /D 069 /E 070 /F 071 /G 072 /H 073 /I 074 /J 075 /K 076 /L 077 /M 078 /N 079 /O 080 /P 081 /Q 082 /R 083 /S 084 /T 085 /U 086 /V 087 /W 088 /X 089 /Y 090 /Z 091 /bracketleft 092 /backslash 093 /bracketright 094 /asciicircum 095 /underscore 096 /quoteleft 097 /a 098 /b 099 /c 100 /d 101 /e 102 /f 103 /g 104 /h 105 /i 106 /j 107 /k 108 /l 109 /m 110 /n 111 /o 112 /p 113 /q 114 /r 115 /s 116 /t 117 /u 118 /v 119 /w 120 /x 121 /y 122 /z 123 /braceleft 124 /bar 125 /braceright 126 /asciitilde 127 /.notdef 128 /grave 129 /circumflex 130 /caron 131 /breve 132 /hungarumlaut 133 /cedilla 134 /ogonek 135 /tilde 136 /dotaccent 137 /dotlessi 138 /Lslash 139 /.notdef 140 /.notdef 141 /.notdef 142 /fl 143 /fraction 144 /quotesingle 145 /quotedblleft 146 /quotedblbase 147 /quotedblright 148 /guilsinglleft 149 /guilsinglright 150 /endash 151 /emdash 152 /periodcentered 153 /ellipsis 154 /lslash 155 /.notdef 156 /.notdef 157 /.notdef 158 /fi 159 /.notdef 160 /.notdef 161 /exclamdown 162 /cent 163 /sterling 164 /Euro 165 /yen 166 /Scaron 167 /section 168 /scaron 169 /copyright 170 /ordfeminine 171 /guillemotleft 172 /logicalnot 173 /.notdef 174 /registered 175 /macron 176 /ring 177 /plusminus 178 /twosuperior 179 /threesuperior 180 /Zcaron 181 /mu 182 /paragraph 183 /bullet 184 /zcaron 185 /onesuperior 186 /ordmasculine 187 /guillemotright 188 /OE 189 /oe 190 /Ydieresis 191 /questiondown 192 /Agrave 193 /Aacute 194 /Acircumflex 195 /Atilde 196 /Adieresis 197 /Aring 198 /AE 199 /Ccedilla 200 /Egrave 201 /Eacute 202 /Ecircumflex 203 /Edieresis 204 /Igrave 205 /Iacute 206 /Icircumflex 207 /Idieresis 208 /Eth 209 /Ntilde 210 /Ograve 211 /Oacute 212 /Ocircumflex 213 /Otilde 214 /Odieresis 215 /multiply 216 /Oslash 217 /Ugrave 218 /Uacute 219 /Ucircumflex 220 /Udieresis 221 /Yacute 222 /Thorn 223 /germandbls 224 /agrave 225 /aacute 226 /acircumflex 227 /atilde 228 /adieresis 229 /aring 230 /ae 231 /ccedilla 232 /egrave 233 /eacute 234 /ecircumflex 235 /edieresis 236 /igrave 237 /iacute 238 /icircumflex 239 /idieresis 240 /eth 241 /ntilde 242 /ograve 243 /oacute 244 /ocircumflex 245 /otilde 246 /odieresis 247 /minus 248 /oslash 249 /ugrave 250 /uacute 251 /ucircumflex 252 /udieresis 253 /yacute 254 /thorn 255 /ydieresis ./mpage-2.5.6/mpage.1.in0000644002342000234200000003251510742655604014035 0ustar marcelmarcel.TH MPAGE Local 2008/01/14 .SH NAME mpage \- print multiple pages per sheet on PostScript printer .SH SYNOPSIS .B mpage .RB [ \-1248aAceEfHloOrRStTuUvVxX ] .RB [ \-b\c .IR "\ papersize" ] .RB [ \-B\c .RI [ "num" [\c .BR lrtb ]]...] .RB [ \-C .RI [ "encoding" ]] .RB [ \-da\c .IB | p\c ] .RB [ \-D\c .IR "\ dateformat" ] .RB [ \-F\c .IR "\ fontname" ] .RB [ \-h\c .IR "\ header" ] .RB [ \-j\c .IR "\ first" [\-\c .IR last ][%\c .IR interval ]] .RB [ \-J\c .IR "\ startpageno" ] .RB [ \-L\c .IR "\ lines" ] .RB [ \-m\c .RI [ "num" [\c .BR lrtb ]]...] .RB [ \-M\c .RI [ "num" [\c .BR lrtb ]]...] .RB [ \-p\c .RI [ "prprog" ]] .RB [ \-P\c .RI [ "printer" ]] .RB [ \-s\c .IR "\ tabstop" ] .RB [ \-W\c .IR "\ width" ] .RB [ \-z\c .IR "\ printcmd" ] .RB [ \-Z\c .IR "\ printcmd_args" ] .RI [ file \ ...] .SH DESCRIPTION .I mpage reads plain text files or PostScript documents and prints them on a PostScript printer with the text reduced in size so that several pages appear on one sheet of paper. This is useful for viewing large printouts on a small amount of paper. It uses ISO 8859.1 to print 8-bit characters. .PP The following options are recognized (note that arguments to options may be separated from the option by spaces, except for .BR -B , .BR -m , .BR -M , .B -p and .BR -P ): Also when mpage encounters -- as option it will stop parsing arguments and the remaining arguments are interpreted as filenames. .TP .B -1 Print 1 normal page per sheet (included for symmetry). .TP .B -2 Print 2 normal pages per sheet. .TP .B -4 Print 4 normal pages per sheet .IR (default) . .TP .B -8 Print 8 normal pages per sheet. .TP .B -a Toggle layout of the pages on the sheet so that successively numbered pages run down the sheet, as opposed to left to right. .RI ( default updown) . .TP .B -A This option is deprecated, see \fB-b\fP. Prepare output for A4 sized paper. For default see 'mpage -x'. .TP .BI -b papertype Prepare output for selected paper type. .I Papersize can be \fIA3\fP for European A3, \fIA4\fP for European A4, \fILetter\fP for US Letter or \fILegal\fP for Legal sized paper. For default see 'mpage -x'. To see the list of currently available types, just give the 'mpage -bl' or 'mpage -b?' command (Note: mpage exits after finding such option use.) .TP .BR -B [\fI\fR[\fBlrtb\fR]*] Setup a box around a particular part of your page. Specify text box margins and line thickness. The default is 0 columns (lines) for both left and right (top and bottom) margins and 0 line thickness. Specifying .B -B solely toggles printing of the box. .IR l , .IR r , .I t or .I b set the left, right, top or bottom margin respectively to .I columns (lines). Not specifying any of the sides, will set the line thickness when .I is given. For example .BI -B 1 sets the line thickness to 1. Sides with negative margins will not print. .TP .B -c Toggle concatenation off pages from different files on single sheets .RI ( default off). .TP .BR -C [\fIencodingfile\fR] Specify the character encoding file. The file should be in the mpage library directory (\fIPREFIX/share/mpage\fR). .I Mpage has an internal default encoding based on Latin-1 or IBM codepage 850. Depending on compile time option this encoding definition is on or not. Not specifying an encodingfile will toggle the usage of the internal encoding. .TP .BI -d a\fR|\fIp Force input to be taken as ascii (\fIa\fP) or postscript (\fIp\fP) text. This way you can print your postscript code as text, or print postscript code that mpage does not recognise. When using \fB-d\fIp\fR, make sure that the the postscript code contains .I %Page page separators or else things will probably look odd. .TP .BI -D dateformat Set the date format as in .IR strftime (3) to be used in date/time representations (e.g. in headers). (Note: to be useful you probably need the \fB-H\fP option.) .TP .B -e Print 2 normal pages per sheet in duplex mode. Every first and fourth page or on one side and every second and third on the other side. This is more or less a combination of the \fR-O\fP and \fR-E\fP option but then in one pass. .TP .B -E Print 2 normal pages per sheet. However, this option will print every second and third page of every set of four pages. This option will ignore .B -a and .BR -l . See also the \fR-O\fP option. Using these options double sided prints can be created without a duplex printer. .TP .B -f Toggles folding lines longer than page width .RI ( default off) . .TP .BI -F fontname Specify font. .RI ( default Courier). Check your printer for supported fonts. Note: this has almost nothing to do with the fonts used for your X-windows/KDE/Gnome environment. .TP .BI -h header This is used only when the .B -p or .B -H switch is used and is passed as the "\fB-h\fI\ header\fR" option to .BR pr ( 1 ) or as the header for .BR -H . .TP .B -H Create header line for each logical page separated from page text by a horizontal line. Unless .B -h is given, the header consist of last file modification time, filename and page number, all in bold and slightly larger font. This option only applies to non-postscript files. .TP .BI -I indent Indent text by .I indent characters. .TP .BI -j first\fR[\fI-last\fR][\fI%interval\fR] Print just the selected sheets, specified by a number, starting at 1. Here .I last defaults to the end of data, \fIinterval\fP to 1. Several \fB-j\fR options can be given (upto MAXJARGS, default 100) to create a complex selection of pages. Thus \fB-j\fI1\-10\fR selects the first 10 sheets, while \fB-j\fI 1%2\fR prints just the odd-numbered sheets and \fB-j\fI 2%2\fR prints just the even ones. .sp You can do double-sided printing, in two passes, as follows. If you use 3-hole punched paper, put it in the printer such that the holes will appear at the top of the page -- on the right as you pull out the printer tray, in our Laser writer II NTX. Print the odd-numbered sheets with .IP .ti +5 mpage ... -j 1%2 ... .IP Note the number of pages it reports. (Only half this many will really be printed). When printing finishes, if mpage reported an \fIodd\fP number of pages, remove the last one from the stack, since there will be no even-numbered sheet to match it. Then arrange the stack of paper for printing on the other side. (If it's punched, the holes will now be on the left.) On our II NTX, the paper comes out blank-side up; replace it in the tray still blank-side up but rotated 180 degrees. For other printers, you figure it out. Now print the even-numbered sheets in reverse order with .IP .ti +5 mpage ... -r -j 2%2 ... .IP hoping no one else reaches the printer before you do. .TP .BI -J startpageno Set the start value of the sheet page count to .I startpageno instead of 1. .TP .B -k When mpage finds a %%TRailer or %%PSTrailer in the postscript input file it normally assumes this is the end of the postscript file and stops reading the input file. But when the PS file includes EPS files, %%Trailers might be anywhere. Using this option ignores the %%TRailer and %%PSTRailer lines. .TP .B -l Toggle printing landscape or portrait mode. Landscape pages are 55 lines long by 132 characters wide by default. Portrait pages are 66 lines long by 80 characters wide by default. .RI ( default portrait.) .TP .BI -L lines Adjust the page reduction parameters so that .I lines lines will fit in the space of one page. This overrides the default values normally supplied. (See .BR -l .) If used in conjunction with .B -p then this value is passed to the .BR pr (1) as well. As a side effect this changes the font size as well (as will the \fB-W\fR option.) So while there is an option to change font family, there is no explicit option to change font size! .TP .BR -m [\fI\fR[\fBlrtb\fR]*] Specify sheet margin. The default margin is 20 points. Only specifying .B -m sets left margin to 40 points. .IR l , .IR r , .I t or .I b set left, right, top or bottom margin respectively to .I points. Not specifying any of the sides will set all sides when .I is given. .I defaults to 40 points. For example .BI -m 10 sets all margins to 10 points. .BI -m l50tb sets left margin to default 40 and top and bottom margin to 50 points. .BI -m 50l25bt30r set bottom and top margin to 25, left margin to 50 and right margin to 30 points. Margins can have negative numbers. .TP .BR -M [\fI\fR[\fBlrtb\fR]*] Specify logical page margins. For syntax, see .B -m option. Defaults are 4 for .B -M solely, and 8 for .IR . Margins can be negative. This way large white borders in your (postscript) documents can be reduced. .TP .B -o Toggle printing of outlines around each reduced page .RI ( default on). .TP .B -O Print 2 normal pages per sheet. However, this option will print every first and fourth page of every set of four pages. This option will ignore .B -a and .BR -l . See also the \fR-E\fP option. Using these options double sided prints can be created without a duplex printer. .TP .BR -p [\fIprprog\fR] Pipe input through .I prprog command (including specified options) before printing (assumes the input is a text file). When no command is specified, it defaults to .BR pr (1). .TP .BR -P [\fIprinter\fR] Specify the printer to which the PostScript output will be sent (e.g.lpr -P\fIprinter\fP). Using .B -P with no printer specified will send the PostScript to the default printer queue (e.g. lpr). Using -P- will return output to stdout, useful in combination with MPAGE environment variable. Without .B -P output will be send to standard output. .TP .B -r Reverse printing. The last sheet is printed first. The way of arranging reduced pages on the sheets doesn't change. .TP .B -R Switch to left to right mode, starting first page on left bottom corner. This might be useful for landscape postscript files. (Note: using .B -l after .B -R undoes .BR -R , and switches to normal landscape mode. .TP .BI -s tabstop Set tabstop width (\fIdefault\fP 8 characters). Should by >= 2. .TP .B -S Accept non-square page reduction. By default, pages are shrunk equally in X and Y, even if this wastes some space on the sheet. With \fB\-S\fP, reduced pages are larger but slightly distorted. (only used when printing postscript files.) .TP .B -t Toggle printing on both sides of the paper. This will toggle duplex mode of the printer. Use this option only if your printer is capable of printing in duplex mode. .RI ( default off). .TP .B -T Toggle tumble of every second pages when printing in duplex mode. Use this option only if your printer is capable of printing in duplex mode and together with .BR -t . .TP .B -u Toggle checking for UTF-8 input (not relevant for postscript input). .TP .B -U This option is deprecated, see \fB-b\fP. Prepare output for US Letter sized paper. For default see 'mpage -x'. .TP .B -v Toggle printing a count of the number of sheets produced for printing .RI ( default off.) .TP .B -V Print version information and exit. .TP .BI -W width Adjust the page reduction parameters so that a line with .I width characters long will fit in the space of one page. This overrides the default values normally supplied. (See .BR -l .) If used in conjunction with .B -p then this value is passed to the s .BR pr (1) program as well. See also the \fB-L\fP\ option on font sizes. .TP .B -x Force usage display, which also shows current defaults. .TP .B -X [header] Print header on the left and the page number on the right of each physical page (sheet). If no header is given, the default is the current filename (note influence of .BR -c ), the filename of the first file on the page is used. .TP .BI -z printcommand Specify command to use to send output to. Default is .B lpr (1) for BSD style spooler, .B lp (1) for SYSV style spooler. You can specify command line options, but note .BR -Z . For example \fB-zlp\fR for system V Unix. .TP .BI -Z printprog_queuename_arg Specify what option to use for the "\fB-z\fI\ printcommand\fR" to specify a printqueue. For example \fB-zlp -Z-d\fR for system V Unix. Default is .B -P for BSD style spooler, .B -d for SYSV style spooler. .PP .SH ENVIRONMENT .I mpage examines the .B PRINTER (or .B LPDEST for SYSV style spooler) environment variable to override its default printer. .PP The .B MPAGE_LIB environment variable can be used to control where the character encoding files (\fB-C\fR) can be found. .PP .I mpage also examines the .B MPAGE environment variable for default option settings. Any option or combination of options can be specified in the .B MPAGE environment variable. For example, if MPAGE is set to the string: .IP .B -2oPqms -L60 .PP it would (in the absence of other command line arguments) print 2 pages per sheet, 60 lines per page, with outlines, on the printer named .B "qms" (overriding the .B PRINTER\fR/\fBLPDEST environment variable, if it exists.) In the environment variable, white space is used as an option delimiter, and no quoting is recognized. .PP Any command line options will override both the .B PRINTER and .B MPAGE environment variables. .SH FILES /usr/tmp/mpageXXXXXX .br PREFIX/share/mpage .SH BUGS .PP Suffers under the burden of far too many switches. (But .B you wanted the choices!) .PP NULL characters in a postscript input file will cause mpage to crash! .PP Many others, we're sure. Mpage is year 2000 compliant, as long as the underlying operating system is!!! .SH VERSION Version 2.5.6, Released Januari 2008. .br Location: .IP http://www.mesa.nl/pub/mpage .br ftp://ftp.mesa.nl/pub/mpage .SH AUTHORS Marcel Mol (current maintainer). .PP Mark P. Hahn (Original author) ./mpage-2.5.6/encoding.h0000644002342000001440000001030110056434024014062 0ustar marcelusers/* * encoding.h * * %%%% ISO-Latin.1 encoding plus Standaard plus other postscript * encodings in the undefined entries * 26 255 % first and last encoding */ /* * mpage: A program to reduce pages of print so that several pages * of output appear on one sheet of paper. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * */ int encoding_table_first = 26; int encoding_table_last = 255; char encoding_table[][40] = { "026 /Scaron", "027 /Ydieresis", "028 /Zcaron", "029 /scaron", "030 /trademark", "031 /zcaron", "032 /space", "033 /exclam", "034 /quotedbl", "035 /numbersign", "036 /dollar", "037 /percent", "038 /ampersand", "039 /quoteright", "040 /parenleft", "041 /parenright", "042 /asterisk", "043 /plus", "044 /comma", "045 /minus", "046 /period", "047 /slash", "048 /zero", "049 /one", "050 /two", "051 /three", "052 /four", "053 /five", "054 /six", "055 /seven", "056 /eight", "057 /nine", "058 /colon", "059 /semicolon", "060 /less", "061 /equal", "062 /greater", "063 /question", "064 /at", "065 /A", "066 /B", "067 /C", "068 /D", "069 /E", "070 /F", "071 /G", "072 /H", "073 /I", "074 /J", "075 /K", "076 /L", "077 /M", "078 /N", "079 /O", "080 /P", "081 /Q", "082 /R", "083 /S", "084 /T", "085 /U", "086 /V", "087 /W", "088 /X", "089 /Y", "090 /Z", "091 /bracketleft", "092 /backslash", "093 /bracketright", "094 /asciicircum", "095 /underscore", "096 /quoteleft", "097 /a", "098 /b", "099 /c", "100 /d", "101 /e", "102 /f", "103 /g", "104 /h", "105 /i", "106 /j", "107 /k", "108 /l", "109 /m", "110 /n", "111 /o", "112 /p", "113 /q", "114 /r", "115 /s", "116 /t", "117 /u", "118 /v", "119 /w", "120 /x", "121 /y", "122 /z", "123 /braceleft", "124 /bar", "125 /braceright", "126 /asciitilde", "127 /.notdef", "128 /fraction", "129 /florin", "130 /quotesingle", "131 /quotedblleft", "132 /guilsinglleft", "133 /guilsinglright", "134 /fi", "135 /fl", "136 /endash", "137 /dagger", "138 /daggerdbl", "139 /bullet", "140 /quotesinglbase", "141 /quotedblbase", "142 /quotedblright", "143 /ellipsis", "144 /dotlessi", "145 /grave", "146 /acute", "147 /circumflex", "148 /tilde", "149 /oe", "150 /breve", "151 /dotaccent", "152 /perthousand", "153 /emdash", "154 /ring", "155 /Lslash", "156 /OE", "157 /hungarumlaut", "158 /ogonek", "159 /caron", "160 /lslash", "161 /exclamdown", "162 /cent", "163 /sterling", "164 /currency", "165 /yen", "166 /brokenbar", "167 /section", "168 /dieresis", "169 /copyright", "170 /ordfeminine", "171 /guillemotleft", "172 /logicalnot", "173 /hyphen", "174 /registered", "175 /macron", "176 /degree", "177 /plusminus", "178 /twosuperior", "179 /threesuperior", "180 /acute", "181 /mu", "182 /paragraph", "183 /periodcentered", "184 /cedilla", "185 /onesuperior", "186 /ordmasculine", "187 /guillemotright", "188 /onequarter", "189 /onehalf", "190 /threequarters", "191 /questiondown", "192 /Agrave", "193 /Aacute", "194 /Acircumflex", "195 /Atilde", "196 /Adieresis", "197 /Aring", "198 /AE", "199 /Ccedilla", "200 /Egrave", "201 /Eacute", "202 /Ecircumflex", "203 /Edieresis", "204 /Igrave", "205 /Iacute", "206 /Icircumflex", "207 /Idieresis", "208 /Eth", "209 /Ntilde", "210 /Ograve", "211 /Oacute", "212 /Ocircumflex", "213 /Otilde", "214 /Odieresis", "215 /multiply", "216 /Oslash", "217 /Ugrave", "218 /Uacute", "219 /Ucircumflex", "220 /Udieresis", "221 /Yacute", "222 /Thorn", "223 /germandbls", "224 /agrave", "225 /aacute", "226 /acircumflex", "227 /atilde", "228 /adieresis", "229 /aring", "230 /ae", "231 /ccedilla", "232 /egrave", "233 /eacute", "234 /ecircumflex", "235 /edieresis", "236 /igrave", "237 /iacute", "238 /icircumflex", "239 /idieresis", "240 /eth", "241 /ntilde", "242 /ograve", "243 /oacute", "244 /ocircumflex", "245 /otilde", "246 /odieresis", "247 /divide", "248 /oslash", "249 /ugrave", "250 /uacute", "251 /ucircumflex", "252 /udieresis", "253 /yacute", "254 /thorn", "255 /ydieresis" }; ./mpage-2.5.6/Copyright0000644002342000001440000000240510056434017014026 0ustar marcelusers/* * mpage: A program to reduce pages of print so that several pages * of output appear on one sheet of paper. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * marcel@mesa.nl * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * Sr Systems Engineer, Pyramid Technology Corporation * Vienna, Va (703)848-2050 * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * * Marcel Mol MESA Consulting * P.o. box 112 * 2630 AC Nootdorp * The Netherlands * phone: +31-15-3105252 * marcel@mesa.nl mobile: +31-6-54724868 * fax: +31-15-3105253 * info@mesa.nl * http://www.mesa.nl * ftp://ftp.mesa.nl */ ./mpage-2.5.6/Test/0000755002342000001440000000000007554566562013075 5ustar marcelusers./mpage-2.5.6/Test/tabtest0000644002342000001440000000006206124340536014443 0ustar marcelusers123456789012345678 stop stop stopspace ./mpage-2.5.6/Test/testpage0000644002342000001440000000063705571677015014633 0ustar marcelusers1tblkdf89h123456789H1234567890123456789012345678901234567890123456789012345678901 1 2 3 4 5 6 7 8 3 This Text dose not look loke it seems 4 5 6 7 8 9 01 1 2 3 4 5 6 7 8 9 02 1 2 3 4 5 6 7 8 9 03 1 2 3 4 5 6 7 8 9 04 1 2 3 4 5 6 7 8 9 05 1 2 3 4 5 6 7 8 9 06 1 2 3 4 5g 6gyjqpf9 7g 8g 9g 07 ./mpage-2.5.6/Test/nonl0000644002342000001440000000002706502063522013741 0ustar marceluserswith newline no newline./mpage-2.5.6/Test/All.chars0000644002342000001440000000056006104176703014610 0ustar marcelusers 0 [ ] 16 [] 32 [ !"#$%&'()*+,-./] 48 [0123456789:;<=>?] 64 [@ABCDEFGHIJKLMNO] 80 [PQRSTUVWXYZ[\]^_] 96 [`abcdefghijklmno] 112 [pqrstuvwxyz{|}~] 128 [€‚ƒ„…†‡ˆ‰Š‹ŒŽ] 144 [‘’“”•–—˜™š›œžŸ] 160 [ ¡¢£¤¥¦§¨©ª«¬­®¯] 176 [°±²³´µ¶·¸¹º»¼½¾¿] 192 [ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ] 208 [ÐÑÒÓÔÕÖרÙÚÛÜÝÞß] 224 [àáâãäåæçèéêëìíîï] 240 [ðñòóôõö÷øùúûüýþÿ] ./mpage-2.5.6/OS2/0000750002342000001440000000000006762467417012553 5ustar marcelusers./mpage-2.5.6/OS2/lpr.cmd0000640002342000001440000000031006132365416014013 0ustar marcelusers@echo off rem *** lpr.cmd - simulate Unix-like print command for a PS printer rem *** pipes stdin through GhostScript to LPT1 E:\Apps\GS\gsos2 -sDEVICE=cdjmono -r300 -sOutputFile=LPT1 -dNOPAUSE - ./mpage-2.5.6/README.OS20000640002342000001440000000374107374250536013430 0ustar marcelusersOS/2 for mpage 2.5+ A different port cam in. the mpage.def file etc are not needed anymore. README.OS2 - mpage 2.3 for OS/2 Warp (and 2.x) - 1996/04/06 This is a fast and easy port of mpage for OS/2. To BUILD, you need the emx0.9c port of GCC (maybe it also works with previous versions, I haven't tried) and GNU make (3.74). Makefile: Check the makefile and set the OS/2 switches. encoding.h: You might want to default to codepage 850 encoding. In that case, copy the enconding.h.PC850 to encoding.h Copy the files from the OS2 directory to its parent directory Then run `make' ... Special files for OS/2: - README.OS2 : this file - encoding.h.PC850 : new encoding file for codepage 850 In the OS2 directory: - mpage.def, msample.def : LINK386 module definition files - lpr.cmd : simple example for an `lpr'-pipe for OS/2 For INSTALLATION copy `mpage.exe' to a directory in your path and copy the encoding files in `../Encodings' to the directory you have chosen. If you did not rebuild the executable, set the environment variable `MPAGE_LIB' to point to this directory, e.g. `set MPAGE_LIB=E:/usr/lib/mpage' in your `Config.Sys'. To run mpage, you need the emx runtime package (available from ftp.leo.org:/pub/comp/os/os2/). If you like mpage's `-P'-option, you should have an `lpr'-command in your PATH. RESTRICTIONS: I haven't bothered to change anything concerning the output; so it's best to pipe it to whatever you like [file, your PostScript printer, GhostScript (see `lpr.cmd'), NUL for testing the number of pages, ...]. ACKNOWLEDGEMENTS: To Marcel Mol for this fine and useful program. To Eberhard Mattes for emx/gcc that made this port possible. Legal stuff: This port was made in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use it free, but at your own risk. Tilmann Boess , 1996/10/06 ./mpage-2.5.6/encoding.h.PC8500000640002342000001440000001013710056434036014626 0ustar marcelusers/* * encoding.h */ /* * mpage: A program to reduce pages of print so that several pages * of output appear on one sheet of paper. * * Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands * Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia * * Permission is granted to anyone to make or distribute verbatim * copies of this document as received, in any medium, provided * that this copyright notice is preserved, and that the * distributor grants the recipient permission for further * redistribution as permitted by this notice. * * %%%% IBM international codepage 850 encoding for mpage filter * % * % Written by Tilmann Boess , 1996/04/06 * % * 32 255 % first and last encoding * */ int encoding_table_first = 32; int encoding_table_last = 255; char encoding_table[][40] = { "032 /space", "033 /exclam", "034 /quotedbl", "035 /numbersign", "036 /dollar", "037 /percent", "038 /ampersand", "039 /quoteright", "040 /parenleft", "041 /parenright", "042 /asterisk", "043 /plus", "044 /comma", "045 /minus", "046 /period", "047 /slash", "048 /zero", "049 /one", "050 /two", "051 /three", "052 /four", "053 /five", "054 /six", "055 /seven", "056 /eight", "057 /nine", "058 /colon", "059 /semicolon", "060 /less", "061 /equal", "062 /greater", "063 /question", "064 /at", "065 /A", "066 /B", "067 /C", "068 /D", "069 /E", "070 /F", "071 /G", "072 /H", "073 /I", "074 /J", "075 /K", "076 /L", "077 /M", "078 /N", "079 /O", "080 /P", "081 /Q", "082 /R", "083 /S", "084 /T", "085 /U", "086 /V", "087 /W", "088 /X", "089 /Y", "090 /Z", "091 /bracketleft", "092 /backslash", "093 /bracketright", "094 /asciicircum", "095 /underscore", "096 /quoteleft", "097 /a", "098 /b", "099 /c", "100 /d", "101 /e", "102 /f", "103 /g", "104 /h", "105 /i", "106 /j", "107 /k", "108 /l", "109 /m", "110 /n", "111 /o", "112 /p", "113 /q", "114 /r", "115 /s", "116 /t", "117 /u", "118 /v", "119 /w", "120 /x", "121 /y", "122 /z", "123 /braceleft", "124 /bar", "125 /braceright", "126 /asciitilde", "127 /.notdef", "128 /Ccedilla", "129 /udieresis", "130 /eacute", "131 /acircumflex", "132 /adieresis", "133 /agrave", "134 /aring", "135 /ccedilla", "136 /ecircumflex", "137 /edieresis", "138 /egrave", "139 /idieresis", "140 /icircumflex", "141 /igrave", "142 /Adieresis", "143 /Aring", "144 /Eacute", "145 /ae", "146 /AE", "147 /ocircumflex", "148 /odieresis", "149 /ograve", "150 /ucircumflex", "151 /ugrave", "152 /ydieresis", "153 /Odieresis", "154 /Udieresis", "155 /oslash", "156 /sterling", "157 /Oslash", "158 /multiply", "159 /florin", "160 /aacute", "161 /iacute", "162 /oacute", "163 /uacute", "164 /ntilde", "165 /Ntilde", "166 /ordfeminine", "167 /ordmasculine", "168 /questiondown", "169 /registered", "170 /logicalnot", "171 /onehalf", "172 /onequarter", "173 /exclamdown", "174 /guillemotleft", "175 /guillemotright", "176 /.notdef", "177 /.notdef", "178 /.notdef", "179 /.notdef", "180 /.notdef", "181 /Aacute", "182 /Acircumflex", "183 /Agrave", "184 /copyright", "185 /.notdef", "186 /.notdef", "187 /.notdef", "188 /.notdef", "189 /cent", "190 /yen", "191 /.notdef", "192 /.notdef", "193 /.notdef", "194 /.notdef", "195 /.notdef", "196 /.notdef", "197 /.notdef", "198 /atilde", "199 /Atilde", "200 /.notdef", "201 /.notdef", "202 /.notdef", "203 /.notdef", "204 /.notdef", "205 /.notdef", "206 /.notdef", "207 /currency", "208 /eth", "209 /Eth", "210 /Ecirumflex", "211 /Edieresis", "212 /Egrave", "213 /dotlessi", "214 /Iacute", "215 /Icircumflex", "216 /Idieresis", "217 /.notdef", "218 /.notdef", "219 /.notdef", "220 /.notdef", "221 /brokenbar", "222 /Igrave", "223 /.notdef", "224 /Oacute", "225 /germandbls", "226 /Ocircumflex", "227 /Ograve", "228 /otilde", "229 /Otilde", "230 /mu", "231 /thorn", "232 /Thorn", "233 /Uacute", "234 /Ucircumflex", "235 /Ugrave", "236 /yacute", "237 /Yacute", "238 /macron", "239 /acute", "240 /hyphen", "241 /plusminus", "242 /.notdef", "243 /threequarters", "244 /paragraph", "245 /section", "246 /divide", "247 /cedilla", "248 /degree", "249 /dieresis", "250 /periodcentered", "251 /onesuperior", "252 /threesuperior", "253 /twosuperior", "254 /.notdef", "255 /.notdef" }; ./mpage-2.5.6/SCOPTIONS0000644002342000001440000000052606762465454013463 0ustar marcelusersCPU=68030 MATH=FFP IGNORE=100 IGNORE=154 IGNORE=161 STRUCTUREEQUIVALENCE STRINGMERGE NOSTACKCHECK OPTIMIZE OPTGLOBAL OPTTIME NOICONS DEFINE=AMIGA INCLUDEDIR=SO:own_include GLOBALSYMBOLTABLE=include:40ffp.gst AUTOREGISTER OPTSCHED NOSINT OPTPEEP OPTINLOCAL OPTINL OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 DEFINE=AMIGA DEFINE=LIBDIR="MPAGE:" ./mpage-2.5.6/Mpage.lsm0000644002342000001440000000153210742655442013712 0ustar marcelusersBegin2 Title = Mpage, many to one page printing utility Desc1 = Mpage takes in plaintext and outputs postscript that will print Desc2 = that text as 1, 2, 4, or 8 pages on 1. Pages are tiled, and Desc3 = seperated by lines. Author = Marcel Mol Maintainer = Marcel Mol Site1 = http://www.mesa.nl Location1 = /pub/mpage Site2 = ftp://ftp.mesa.nl Location2 = /pub/mpage File1 = mpage-2.5.6.tgz FileSize1 = xxx Required1 = A postscript printer, or a postscript interpreter (such as Required2 = ghostscript). CopyPolicy1 = (see README in archive) Permision to distribute archive only CopyPolicy2 = with (c) notice intact Keywords = mpage, printing, postscript, saving trees Comment1 = See CHANGES file. Entered = EnteredBy = Marcel Mol CheckedEmail = marcel@mesa.nl End ./mpage-2.5.6/README.amiga0000644002342000001440000000130306762467374014111 0ustar marcelusersShort: mpage 2.5 (68k+PPC) Author: Marcel Mol, Mark Hahn, Andreas Kleinert (port amiga) Uploader: info@ar-kleinert.de Type: text/misc Amiga 68k/PPC port of Mpage. Mpage is a program to reduce and print multiple pages of text per sheet on a PostScript compatible printer. It also has limited functionality to do the same with postscript files itself. The PPC binaries have the ".elf" extension and is useable from Shell when being used with ppc.library V46+ or Frank Wille's emulation for WOS (V0.6b or higher). Have fun. Usage (for example): MPage TESTFILE >prt: MPage TESTFILE >T:DESTFILE -- ARK, 25/Jul/99 Files specific for amiga: SCOPTIONS mpage.info msample.info ./mpage-2.5.6/mpage.info0000644002342000001440000000150306746573542014121 0ustar marcelusersã[_44ÝP4ݨ%X&p€€ 4øøpÀ`€`lŒ€Æa±°lààÀsSSS‹ ‰€ ‰€ÿÿÿÿÿðÿÿÿÿÿÿà’I$’I$€¤’I’I É$ù$’@’IâI$€¤’?„’I É$~I$’@’Hÿ’$€¤’ÿärI É$9ä’@’II$€¤’GƒI É$‘æ’@’I!ü $€¤’IŒ’I É$‘¬$’@’I!¬I$€¤’I¬’I É$‘t$’@’I#vI$€¤’CvI €4Xÿÿÿÿÿÿà€€ø€€p€À{€ã€f€€€Ç€a±À€là€€€€s€S€S€S€‹€ ‰€€ ‰€€I$’I$$’I’I0I$ù$’PIàI$$’?„’I0I$~$’PHÿ˜I$$’ÿà’I0I$8$’PI $$’GƒI0I$‘æ$’PI!üI$$’IŒ’I0I$‘¬$’PI!¬I$$’I¬’I0I$‘t$’PI#vI$$’CvI0ÿÿÿÿÿðJUNK./mpage-2.5.6/NEWS0000644002342000001440000000300210742655477012645 0ustar marcelusersUser visable changes Version 2.5.6 Januari 2008 -------------------------- - honour /etc/papaersize file Version 2.5.5 November 2006 -------------------------- - Builds with gcc4 - large page margins specs wont give unpredictable results. - Enabling KANJI support should still provide viable output for non-KANJI locales Version 2.5.4 May 2004 -------------------------- - Support for UTF-8 files. - Various fixes Version 2.5.3 Oktober 2002 -------------------------- - Support A0 paper - A Newline after a formfeed is removed. - the -X option now always prints the filename/header on the left and the physical page number on the right. - New -J option to set initial page counter value. - Improved handling of Postscript input with EPS includes. - Other bugfixes Version 2.5.2 Januari 2002 -------------------------- - Various fixes - Support for more paper types See CHANGES file for detailed changelog Version 2.5 November 1997 ------------------------- - Support for A3 paper - dvips output should work better now. Note: figures might still go wrong and some dvips file still fail... - Included mergeps program to merger two postscript files. See Contrib/mergeps.txt for details. Version 2.4 September 1996 -------------------------- - option -b to select papersize. This obsoletes the -A and -U option, but these are still maintained for backward comatibility. - option -X to print sheet header. - option -s to set tabstop. - Special release for the CD companion to Evi Nemeth's Unix System Management book. ./mpage-2.5.6/msample.info0000644002342000001440000000150306746574174014470 0ustar marcelusersã[_4’¸#ð&p'X€€ 4øøpÀ`€`lŒ€Æa±°lààÀsSSS‹ ‰€ ‰€ÿÿÿÿÿðÿÿÿÿÿÿà’I$’I$€¤’I’I É$ù$’@’IâI$€¤’?„’I É$~I$’@’Hÿ’$€¤’ÿärI É$9ä’@’II$€¤’GƒI É$‘æ’@’I!ü $€¤’IŒ’I É$‘¬$’@’I!¬I$€¤’I¬’I É$‘t$’@’I#vI$€¤’CvI €4Xÿÿÿÿÿÿà€€ø€€p€À{€ã€f€€€Ç€a±À€là€€€€s€S€S€S€‹€ ‰€€ ‰€€I$’I$$’I’I0I$ù$’PIàI$$’?„’I0I$~$’PHÿ˜I$$’ÿà’I0I$8$’PI $$’GƒI0I$‘æ$’PI!üI$$’IŒ’I0I$‘¬$’PI!¬I$$’I¬’I0I$‘t$’PI#vI$$’CvI0ÿÿÿÿÿðJUNK./mpage-2.5.6/smakefile0000644002342000001440000001126610056433570014026 0ustar marcelusers# # mpage: A program to reduce pages of print so that several pages # of output appear on one sheet of paper. # # Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands # Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia # # Permission is granted to anyone to make or distribute verbatim # copies of this document as received, in any medium, provided # that this copyright notice is preserved, and that the # distributor grants the recipient permission for further # redistribution as permitted by this notice. # # Marcel Mol MESA Consulting # Hogeveenseweg 12 P.o. box 112 # 2631 PH Nootdorp 2630 AC Nootdorp # The Netherlands The Netherlands # phone: 015-3101310 phone: +31-6-54724868 # marcel@mesa.nl info@mesa.nl # http://www.mesa.nl/pub/mpage # ftp://ftp.mesa.nl/pub/mpage # # Amiga SAS/C adjustments by Andreas R. Kleinert 1999 # Set this to an ANSI compatible C compiler (preferably gcc) # See also system specific settings below #CC=cc CC=gcc ############################################################################ # # MPAGE Configuration # ############################################################################ # # Define your favorite page size: # Letter for US letter # Legal for legal # A4 for European A4 # See glob.c for all possibilities # # PAGESIZE=Letter PAGESIZE=A4 # # Define your spooler type # ATT_SPOOLER for 'lp ...' type printing # BSD_SPOOLER for 'lpr ..' tpye printing # SPOOL_TYPE=BSD_SPOOLER # PREFIX=e:/usr # OS/2 type PREFIX=/usr/local BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/lib MANDIR=$(PREFIX)/man/man1 # # A default encoding is given in encoding.h. Setting ENCODING=1 will # activate this encoding by default. 0 switches default off. # The -C option (without subargument) can be used to switch. # ENCODING=1 # # Set the default sheet margin in 1/72 inches. # SHEETMARGIN=20 DEFS = -DPAGE_DEF=\"${PAGESIZE}\" -DLIBDIR=\"${LIBDIR}/mpage\" -DDEFAULT_ENCODING=${ENCODING} -DDEFAULTSMARGIN=${SHEETMARGIN} -DSPOOLER=${SPOOL_TYPE} ############################################################################ # # OPERATING SYSTEM SETUP # ############################################################################ # Unix extensions E = O = .o # OS/2: # CFLAGS = -O2 $(DEFS) -Wall # LIBS = -Zcrtdll -s # DEF_FILE = mpage.defM # E = .exe # O = .o # MSDOS extensions # E = .exe # O = .obj # AMIGA 68k CC=sc CFLAGS = ############################################################################ # # UNIXEN SPECIFICS # ############################################################################ # Choose one of the following CFLAGS/CC definitions: # If you are using gcc, you probably don't need to change anything here. # Linux: #CFLAGS = -O2 -s $(DEFS) -Wall # AIX (xlC on aix 4): #CFLAGS = -O2 -s $(DEFS) # SunOS 4.1.3_U1 1 sun4m (gcc 2.7.2) #CFLAGS = -O2 -s $(DEFS) -D__USE_FIXED_PROTOTYPES__ -Wall # SunOS 4.1.3_U1 1 sun4m (standard C-compiler (NOTE: sample.c will not # compile, since the standard cc is not ANSI-standard) #CFLAGS = -O2 -s $(DEFS) # HP-UX A.09.01 A 9000/735 (standard cc) #CFLAGS = -Aa +O3 -s $(DEFS) -D_INCLUDE_POSIX_SOURCE -Wall # BeOS #CFLAGS= -O2 $(DEFS) ############################################################################ # # END OF CONFIGURATION OPTIONS # # pattern rules. Should we define these? %$(O): %.c $(CC) $(CFLAGS) -c -o $@ $< HEAD = mpage.h DENC = encoding.h SRCS = mpage.c glob.c text.c post.c file.c page.c args.c MOBJ = mpage$(O) glob$(O) text$(O) post$(O) file$(O) page$(O) args$(O) SMPL = sample.c page.c glob.c args.c SOBJ = sample$(O) page$(O) glob$(O) args$(O) default: mpage$(E) msample$(E) @echo Done! mpage$(E): $(MOBJ) SLINK LIB:c.o $(MOBJ) TO mpage LIB LIB:sc.lib LIB:amiga.lib SC SD ND msample$(E): $(SOBJ) SLINK LIB:c.o $(SOBJ) TO msample LIB LIB:sc.lib LIB:amiga.lib SC SD ND clean: rm -rf $(MOBJ) mpage$(E) mpage.ps $(SOBJ) msample$(E) make.log core mpage$(O): $(HEAD) $(DENC) mpage.c glob$(O): $(HEAD) glob.c text$(O): $(HEAD) text.c post$(O): $(HEAD) post.c file$(O): $(HEAD) file.c page$(O): $(HEAD) page.c args$(O): $(HEAD) args.c sample$(O): $(HEAD) sample.c mpage.ps: mpage.1 psroff -t -man mpage.1 > mpage.ps # # add your proper install stuff # install: if [ ! -d $(LIBDIR)/mpage ] ; then mkdir -p $(LIBDIR)/mpage ; fi if [ ! -d $(BINDIR) ] ; then mkdir -p $(BINDIR) ; fi if [ ! -d $(MANDIR) ] ; then mkdir -p $(MANDIR) ; fi cp mpage$(E) $(BINDIR) cp mpage.1 $(MANDIR) -cp Encodings/* $(LIBDIR)/mpage -chmod 644 $(LIBDIR)/mpage/* ./mpage-2.5.6/smakefile.ppc0000644002342000001440000001135710056433577014617 0ustar marcelusers# # mpage: A program to reduce pages of print so that several pages # of output appear on one sheet of paper. # # Copyright (c) 1994-2004 Marcel J.E. Mol, The Netherlands # Copyright (c) 1988 Mark P. Hahn, Herndon, Virginia # # Permission is granted to anyone to make or distribute verbatim # copies of this document as received, in any medium, provided # that this copyright notice is preserved, and that the # distributor grants the recipient permission for further # redistribution as permitted by this notice. # # Marcel Mol MESA Consulting # Hogeveenseweg 12 P.o. box 112 # 2631 PH Nootdorp 2630 AC Nootdorp # The Netherlands The Netherlands # phone: 015-3101310 phone: +31-6-54724868 # marcel@mesa.nl info@mesa.nl # http://www.mesa.nl/pub/mpage # ftp://ftp.mesa.nl/pub/mpage # # Amiga SAS/C adjustments by Andreas R. Kleinert 1999 # Set this to an ANSI compatible C compiler (preferably gcc) # See also system specific settings below #CC=cc CC=gcc ############################################################################ # # MPAGE Configuration # ############################################################################ # # Define your favorite page size: # Letter for US letter # Legal for legal # A4 for European A4 # See glob.c for all possibilities # # PAGESIZE=Letter PAGESIZE=A4 # # Define your spooler type # ATT_SPOOLER for 'lp ...' type printing # BSD_SPOOLER for 'lpr ..' tpye printing # SPOOL_TYPE=BSD_SPOOLER # PREFIX=e:/usr # OS/2 type PREFIX=/usr/local BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/lib MANDIR=$(PREFIX)/man/man1 # # A default encoding is given in encoding.h. Setting ENCODING=1 will # activate this encoding by default. 0 switches default off. # The -C option (without subargument) can be used to switch. # ENCODING=1 # # Set the default sheet margin in 1/72 inches. # SHEETMARGIN=20 DEFS = -DPAGE_DEF=\"${PAGESIZE}\" -DLIBDIR=\"${LIBDIR}/mpage\" -DDEFAULT_ENCODING=${ENCODING} -DDEFAULTSMARGIN=${SHEETMARGIN} -DSPOOLER=${SPOOL_TYPE} ############################################################################ # # OPERATING SYSTEM SETUP # ############################################################################ # Unix extensions E = O = .o # OS/2: # CFLAGS = -O2 $(DEFS) -Wall # LIBS = -Zcrtdll -s # DEF_FILE = mpage.defM # E = .exe # O = .o # MSDOS extensions # E = .exe # O = .obj # AMIGA 68k CC=scppc CFLAGS = ############################################################################ # # UNIXEN SPECIFICS # ############################################################################ # Choose one of the following CFLAGS/CC definitions: # If you are using gcc, you probably don't need to change anything here. # Linux: #CFLAGS = -O2 -s $(DEFS) -Wall # AIX (xlC on aix 4): #CFLAGS = -O2 -s $(DEFS) # SunOS 4.1.3_U1 1 sun4m (gcc 2.7.2) #CFLAGS = -O2 -s $(DEFS) -D__USE_FIXED_PROTOTYPES__ -Wall # SunOS 4.1.3_U1 1 sun4m (standard C-compiler (NOTE: sample.c will not # compile, since the standard cc is not ANSI-standard) #CFLAGS = -O2 -s $(DEFS) # HP-UX A.09.01 A 9000/735 (standard cc) #CFLAGS = -Aa +O3 -s $(DEFS) -D_INCLUDE_POSIX_SOURCE -Wall # BeOS #CFLAGS= -O2 $(DEFS) ############################################################################ # # END OF CONFIGURATION OPTIONS # # pattern rules. Should we define these? %$(O): %.c $(CC) $(CFLAGS) -c -o $@ $< HEAD = mpage.h DENC = encoding.h SRCS = mpage.c glob.c text.c post.c file.c page.c args.c MOBJ = mpage$(O) glob$(O) text$(O) post$(O) file$(O) page$(O) args$(O) SMPL = sample.c page.c glob.c args.c SOBJ = sample$(O) page$(O) glob$(O) args$(O) default: mpage$(E) msample$(E) @echo Done! mpage$(E): $(MOBJ) ppc-amigaos-ld -r lib:c_ppc.o $(MOBJ) LIB:scppc.a lib:end.o -o mpage.elf Protect mpage.elf +e msample$(E): $(SOBJ) ppc-amigaos-ld -r lib:c_ppc.o $(SOBJ) LIB:scppc.a lib:end.o -o msample.elf Protect msample.elf +e clean: rm -rf $(MOBJ) mpage$(E) mpage.ps $(SOBJ) msample$(E) make.log core mpage$(O): $(HEAD) $(DENC) mpage.c glob$(O): $(HEAD) glob.c text$(O): $(HEAD) text.c post$(O): $(HEAD) post.c file$(O): $(HEAD) file.c page$(O): $(HEAD) page.c args$(O): $(HEAD) args.c sample$(O): $(HEAD) sample.c mpage.ps: mpage.1 psroff -t -man mpage.1 > mpage.ps # # add your proper install stuff # install: if [ ! -d $(LIBDIR)/mpage ] ; then mkdir -p $(LIBDIR)/mpage ; fi if [ ! -d $(BINDIR) ] ; then mkdir -p $(BINDIR) ; fi if [ ! -d $(MANDIR) ] ; then mkdir -p $(MANDIR) ; fi cp mpage$(E) $(BINDIR) cp mpage.1 $(MANDIR) -cp Encodings/* $(LIBDIR)/mpage -chmod 644 $(LIBDIR)/mpage/* ./mpage-2.5.6/FAQ0000644002342000001440000000216306523100536012466 0ustar marcelusersLandscape misorder from TeX/dvips to mpage ========================================== When (La)TeX output is 'upside down' when printing it with mpage the following might help (from Ted Stern ). I found that part of the problem was that my latex document was being rotated by -90 degrees by dvips when the postscript was produced in landscape form. By putting the starred line in at the top of my document (some slides, for example): \documentclass[landscape]{slides} %% ... \begin{document} \special{! /landplus90 true store}% * * * line to include * * * %% line above has to be on the first page! %% %% ... \end{document} and processing the document with dvips -t landscape filename.dvi -o filename.ps , dvips will instead rotate the page by +90 degrees. The result is that I get a postscript file that can be printed out using your current landscape handling option with no other modifications required. This information is buried in the dvips manual somewhere, but is not easy to find! ./mpage-2.5.6/util.c0000644002342000001440000000101106762601337013256 0ustar marcelusers/* * Utility functions for memory management. Very primitive. * ema@csn.es */ static char *pos; static int maxsize; #define NULL (void *)0 void memgets_init(memarea, size) char *memarea; int size; { pos = memarea; maxsize = size; } char *memgets(output, maxitems) char *output; int maxitems; { char *retval = output; while (maxitems-- && maxsize-- >=0 && (*output++=*pos++) != '\n' ) ; *output = '\0'; if (maxsize >= 0) return retval; else return NULL; } ./mpage-2.5.6/COPYING0000644002342000000120000004313107324302233013122 0ustar marcelwheel GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ./mpage-2.5.6/gpl.in0000644002342000000120000000140707502710642013206 0ustar marcelwheel/* * * This file is part of mpage. * * Mpage is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Mpage is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Foobar; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ./mpage-2.5.6/COPYING.LESSER0000644002342000000120000006347607324302233014134 0ustar marcelwheel GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it!