diff options
author | Karl Berry <karl@freefriends.org> | 2010-06-12 00:48:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-06-12 00:48:49 +0000 |
commit | b7d09128d54f9b6bb737e80e906499037529904e (patch) | |
tree | 68ea16ac010aeee726f77bcec9162525feb14a7e /Master/texmf-dist/doc/generic/xypic/support | |
parent | 457703ea12a711958a619ba5f9e665242c1dcfe7 (diff) |
xypic 3.8.1 (11jun10)
git-svn-id: svn://tug.org/texlive/trunk@18907 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/xypic/support')
3 files changed, 557 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/xypic/support/dvitogif89a b/Master/texmf-dist/doc/generic/xypic/support/dvitogif89a new file mode 100644 index 00000000000..2a17aa4002b --- /dev/null +++ b/Master/texmf-dist/doc/generic/xypic/support/dvitogif89a @@ -0,0 +1,212 @@ +#!/bin/sh +# $Id: dvitogif89a,v 3.7 2010/06/10 18:45:49 krisrose Exp $ +# +# Pack consecutive pages of TeX DVI file as GIF89a animation. +# Copyright (c) 1996-1997 Kristoffer H. Rose <krisrose@tug.org> +# +# This file is part of the Xy-pic macro package. +# Copyright (c) 1991-2010 Kristoffer H. Rose <krisrose@tug.org> +# See the README and INSTALL files for further information. +# +# The Xy-pic package 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. +# +# The Xy-pic package 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 package; if not, see http://www.gnu.org/licenses/. + +NAME=`basename $0` +SYNOPSIS="Usage: $NAME file[.dvi]" +DESCRIPTION="Pack consecutive pages of TeX DVI file as GIF89a animation." + +# Crop efficiently if possible. +# +if [ -n "`which pnmrawtopcropwhite`" ] +then + cropwhite="pnmrawtopcropwhite |pnmcrop -white" +elif [ -x ./pnmrawtopcropwhite ] +then + cropwhite="./pnmrawtopcropwhite |pnmcrop -white" +else + cropwhite="pnmcrop -white" +fi + +# Check files. +# +ok=yes +# +if [ $# -ne 1 ]; then ok=no; fi +# +dvi="$1.dvi" +if [ ! -f "$dvi" ] +then + dvi="$1" + if [ ! -f "$dvi" ]; then ok=no; fi +fi +# +base=`basename "$dvi" .dvi` +size="$base.size" +# +if [ ! -f "$size" ] +then + echo $NAME": could not find $size file!" >&2 + ok=no +else + eval `cat "$size"` + if [ -z "$dpi" -o -z "$delay" ] + then + echo $NAME": could not interpret $size file!" >&2 + ok=no + fi +fi +# +if [ $ok = no ] +then + echo $SYNOPSIS >&2; exit 2 +fi + +# Initialise. +# +echo "${NAME}: Animating $base." +rm -f $base.ps $base.[0-9][0-9][0-9].* +# +exec 2>"$base.log" +set -x +# +date "+${NAME} Animating $dvi (log started %c)" >&2 + +# Produce PostScript file! +# +echo -n "Producing PostScript..." +echo "Producing PostScript:" >&2 +dvips -D $dpi "$base.dvi" -o "$base.ps" +if [ $? -ne 0 ]; then echo "failed, aborting"; exit 1; else echo "done"; fi +echo '' >&2 + +# Produce PPM files! +# +echo -n "Producing PPMs" +echo "Producing PPMs:" >&2 +echo '' \ +| gs -sOutputFile="|$cropwhite >$base.%03d.ppm" \ + -sDEVICE=ppmraw -r$dpi - "$base.ps" 2>&1 \ +| while read ln; do + echo "$ln" >&2 + case "$ln" in + *cols*off*the*left) echo -n . ;; + esac + done +if [ $? -ne 0 ]; then echo "failed, aborting"; exit 1; else echo "done"; fi +echo '' >&2 + +# Measure first image and alert user. +# +top=0 bottom=0 left=0 right=0 height=0 width=0 +eval `pnmcrop -black "$base.001.ppm" |pnmfile |\ + sed -n -e 's/.*[ \t]\([0-9]*\) by \([0-9]*\).*$/ width=\1 height=\2/p'` +length=`echo $base.[0-9][0-9][0-9].ppm | wc -w | tr -d " \t"` +# +echo "Animation has $length frames of ${width}x${height}." +echo "Length: $length" >&2 +echo "Image size: ${width}x${height}" >&2 + +# Convert to incremental GIFs! +# +echo -n "Producing GIFs" +lastppm= +for ppm in $base.[0-9][0-9][0-9].ppm +do + + echo -n "." + echo -e "\nImage: $ppm" >&2 + + # filenames + gif="`basename $ppm .ppm`.gif" + + # crop black border [sic] + mv $ppm $base.000.ppm + pnmcrop -black $base.000.ppm >$ppm + + # produce smallest GIF image and add to gifpack command + if [ -z "$lastppm" ] + then + + # first bitmap is used directly + ppmtogif $ppm > $gif + gifpack="gifpack -delay $delay $loop -output $base.gif $gif" + + else + + # measure unchanged border + top=0 bottom=0 left=0 right=0 height=0 width=0 + measures="\ + `( pnmarith -difference $lastppm $ppm | pnmcrop | pnmfile )2>&1 \ + | sed -n \ + -e 's/.*cropping \([0-9]*\) .* \([a-z]*\)$/\2=\1/p' \ + -e 's/.* \([0-9]*\) by \([0-9]*\).*$/width=\1 height=\2/p'`" + eval "$measures" + + # if no change just pass top left pixel + if [ $width -lt 1 -o $height -lt 1 ] + then + width=1; height=1; left=1; top=1 + fi + + # add GIF with changed rectangle to animation + pnmcut $left $top $width $height $ppm | ppmtogif >$gif + gifpack="$gifpack +$left,+$top $gif" + + fi + + # prepare next image + lastppm=$ppm + +done +echo "done" +echo '' >&2 + +echo -n "Packing GIFs..." +echo -e "\nPacking animation:" >&2 +eval $gifpack >&2 +if [ $? -ne 0 ]; then echo "failed, aborting"; exit 1; else echo "done"; fi +echo '' >&2 + +# Clean up. +# +rm -f $base.[0-9][0-9][0-9].* + +# Done. +# +echo Done. >&2 +exit + +# $Log: dvitogif89a,v $ +# Revision 3.7 2010/06/10 18:45:49 krisrose +# Reference to GPL by URL. +# +# Revision 3.6 2010/04/16 06:06:51 krisrose +# Preparing for a new release... +# +# Revision 3.5 1997/05/28 13:05:01 krisrose +# Fixed missing breaks bug. +# +# Revision 3.4 1997/05/18 01:14:25 krisrose +# Essential bugfixes. +# +# Revision 1.3 1997/05/01 21:32:32 krisrose +# Changed to exploit pnmrawtopcropwhite hack if available... +# Output cleaned up; uses log file for the rest. +# +# Revision 1.2 1997/05/01 19:23:16 krisrose +# Doesn't quite work... +# +# Revision 1.1 1997/02/11 04:19:23 krisrose +# Initial revision +# +# Based on MakeTeXmovie... diff --git a/Master/texmf-dist/doc/generic/xypic/support/install-tds b/Master/texmf-dist/doc/generic/xypic/support/install-tds new file mode 100644 index 00000000000..34c59bc36f0 --- /dev/null +++ b/Master/texmf-dist/doc/generic/xypic/support/install-tds @@ -0,0 +1,165 @@ +#!/bin/sh +# $Id: install-tds,v 3.13 2010/06/10 18:45:49 krisrose Exp $ +# +# sh(1) installation of Xy-pic into a TeX Directory Structure system. +# Copyright (c) 1997 Kristoffer H. Rose <krisrose@tug.org> +# +# This file is part of the Xy-pic macro package. +# Copyright (c) 1991-2010 Kristoffer H. Rose <krisrose@tug.org> +# See the README and INSTALL files for further information. +# +# The Xy-pic package 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. +# +# The Xy-pic package 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 package; if not, see http://www.gnu.org/licenses/. + +# check that we are in the right place (and get version :) + +# greet +echo '' +echo ' Welcome to the Xy-pic TDS-compliant installation script!' +echo ' Copyright (c) 1997-1998 by krisrose@tug.org' +echo ' Xy-pic is free software: see the User's Guide for details.' +echo '' +echo ' The author has seriously tried to ensure the portability of' +echo ' this script among all un*x platforms, however, if you experience' +echo ' problems then don't hesitate to contact me.' +echo '' +echo ' See the file INSTALL for details about what this script does.' + +# record the argument as TEXMF +: ${TEXMF:=$1} + +# if no TEXMF specified try to figure it out +: ${TEXMF:=`kpsewhich --expand-var='$TEXMFMAIN' 2>/dev/null`} +: ${TEXMF:=`kpsexpand '$TEXMFMAIN' 2>/dev/null`} +: ${TEXMF:=`kpsewhich --expand-var='$TEXMF' 2>/dev/null`} +: ${TEXMF:=`kpsexpand '$TEXMF' 2>/dev/null`} + +if [ -d "$TEXMF" ] +then + echo '' + echo "TEXMF directory $TEXMF found." +else + echo '' + echo 'ERROR: I could not find the TEXMF directory (tried '"$TEXMF"')!' >&2 + echo 'Usage: ./support/install-tds [TEXMF]' >&2 + echo 'Xy-pic installation aborted.' + exit 2 +fi + +# get confirmation +echo '' +echo ' This script will install Xy-pic under the indicated TEXMF tree.' +echo ' We assume that it is the root of a standard TeX Directory Structure.' +echo '' +echo ' Also we asume that the commands find, grep, mkdir, and cp, conform' +echo ' to their POSIX specification and can be found in the standard path.' +echo '' +echo 'Type <enter> to continue (anything else to stop - this is your last chance):' +read reply +if [ -z "$reply" ]; +then + echo '' + echo 'Thanks: proceeding with the installation.' +else + echo 'Xy-pic installation aborted.' + exit 1 +fi + +# warn user about obsolete files +echo '' +echo 'Checking for obsolete files.' +if [ -d "$TEXMF/dvips/xypic" ] +then + + files=`find "$TEXMF/dvips" -name "xy*.map" -print 2>/dev/null` + if [ -n "$files" ] + then + echo 'WARNING: xy*.map files exist:' + echo $files + fi + + files=`find "$TEXMF/dvips" -name psfonts.map -print 2>/dev/null` + files=`grep -svl '^xy' $files /dev/null` + if [ -n "$files" ] + then + echo 'WARNING: psfonts.map xy*-font mappings exist in:' + echo "$files" + fi + + files=`find "$TEXMF/fonts/type1" -name "xy*.pf?" -print 2>/dev/null \ + | grep -v "$TEXMF/fonts/type1/public/xypic/xy.*[.]pfb"` + if [ -n "$files" ] + then + echo 'WARNING: xy*.pfa or xy*.pfb files exist:' + echo "$files" + fi + +fi + +# function for installing simple files in a directory +installd () { + text=$1; shift + dir=`eval 'echo ${'$#'}'` # extract last parameter + echo "Installing $text in $dir." + if mkdir -p "$dir"; then cp -f "$@" + else + echo ' WARNING: could not make directory - files not installed.' + fi +} + +# do the actual installation +echo '' +echo 'Installing Xy-pic!' + +installd "1. administrivia" \ + README CATALOG TRAILER INSTALL MANIFEST VERSIONS *COPYING \ + Xy-pic.html Xy-logo.png \ + "$TEXMF/doc/generic/xypic" +installd "2. macros" texinputs/* "$TEXMF/tex/generic/xypic" +installd "3. font metrics" texfonts/*.tfm "$TEXMF/fonts/tfm/public/xypic" +installd "4. font sources" mfinputs/*.mf "$TEXMF/fonts/source/public/xypic" +installd "5. ps type1 fonts" type1/*.pfb "$TEXMF/fonts/type1/public/xypic" +installd "6. ps pfm fonts" pfm/*.pfm "$TEXMF/fonts/pfm/public/xypic" +installd "7. afm metrics" afm/*.afm "$TEXMF/fonts/afm/public/xypic" +installd "8. ps headers" ps/* "$TEXMF/dvips/xypic" +installd "9. ps font maps" map/* "$TEXMF/map/dvips/xypic" +installd "10. ps font encodings" enc/* "$TEXMF/fonts/enc/dvips/xypic" +installd "11. documentation" doc/xyguide.pdf doc/xyrefer.pdf "$TEXMF/doc/generic/xypic" + +# done +echo "Xy-pic installation done." +exit + +# $Log: install-tds,v $ +# Revision 3.13 2010/06/10 18:45:49 krisrose +# Reference to GPL by URL. +# +# Revision 3.12 2010/06/08 07:28:43 krisrose +# Identify .map file. +# +# Revision 3.11 2010/06/07 04:16:53 krisrose +# Fix forgotten enc files. +# +# Revision 3.10 2010/05/09 22:11:05 krisrose +# Loose /usr/bin prefixes. +# +# Revision 3.9 2010/04/22 14:52:09 krisrose +# Documentation up to date. Install PDF encoding files and XYLU metric files. +# +# Revision 3.8 2010/04/16 06:06:51 krisrose +# Preparing for a new release... +# +# Revision 3.7 1999/02/16 15:12:50 krisrose +# Interim release (Y&Y fonts now free). +# +# New with release 3.5...changed significantly for 3.6. diff --git a/Master/texmf-dist/doc/generic/xypic/support/pnmrawtopcropwhite.c b/Master/texmf-dist/doc/generic/xypic/support/pnmrawtopcropwhite.c new file mode 100644 index 00000000000..e1f69f68abd --- /dev/null +++ b/Master/texmf-dist/doc/generic/xypic/support/pnmrawtopcropwhite.c @@ -0,0 +1,180 @@ +/* $Id: pnmrawtopcropwhite.c,v 3.9 2010/06/10 18:45:49 krisrose Exp $ +** +** Crop off top white lines from raw PBM file (efficiently :) +** Copyright (c) 1991-1998 Kristoffer H. Rose <krisrose@tug.org> +** +** This file is part of the Xy-pic package for graphs and diagrams in TeX. +** Copyright (c) 1991-2010 Kristoffer H. Rose <krisrose@tug.org> +** +** The Xy-pic package 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. +** +** The Xy-pic package 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 package; if not, see http://www.gnu.org/licenses/. +*/ +static const char Id[] = +"@(#)$Id: pnmrawtopcropwhite.c,v 3.9 2010/06/10 18:45:49 krisrose Exp $\n"; + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +/* Globals */ + +#define PBMRAWMAGIC "P4" /* Portable BitMap magic cookie */ +#define PGMRAWMAGIC "P5" /* Portable GrayMap magic cookie */ +#define PPMRAWMAGIC "P6" /* Portable PixMap magic cookie */ +#define MAGICSIZE 2 + +static char *me; /* program name */ + +/* Subroutines */ + +void oops(void) { + fprintf(stderr, "Usage: %s\n", me); + exit(1); +} + +void panic(const char *mess) { + fprintf(stderr, "Error: %s\nUsage: %s\n", mess, me); + exit(2); +} + +void skipcomment(void) { + int c; + while(1) { + switch (c = getchar()) { + case EOF: panic("premature EOF on input"); break; + case '\n': return; + default: break; + } + } +} + +void skipwhite(void) { + int c; + while(1) { + switch (c = getc(stdin)) { + case EOF: panic("premature EOF on input"); break; + case ' ': case '\t': case '\r': case '\n': break; + case '#': skipcomment(); break; + default: ungetc(c, stdin); return; + } + } +} + +int nextint(const char *what) { + int i; + skipwhite(); + if (!scanf("%d", &i)) panic(what); + return i; +} + +/* Program */ + +int main (int argc, char *argv[]) { + + char magic[MAGICSIZE]; + enum { PBM, PGM, PPM } which; + int width, height, newheight, pixelmax; + + int linelength; + char *line, *whiteline; + + /* establish identity and proper usage */ + me = argv[0]; + if (argc != 1) oops(); + + /* magic */ + if (!fread(magic, 1, MAGICSIZE, stdin)) + panic("no magic (nothing on standard input)"); + + if (!memcmp(magic, PBMRAWMAGIC, MAGICSIZE)) + which = PBM; + else if (!memcmp(magic, PGMRAWMAGIC, MAGICSIZE)) + which = PGM; + else if (!memcmp(magic, PPMRAWMAGIC, MAGICSIZE)) + which = PPM; + else + panic("bad magic (standard input not a raw anymap)"); + + /* width and height */ + width = nextint("pixelwidth integer"); + height = nextint("pixelheight integer"); + switch (which) { + case PBM: pixelmax = 0; break; /* hack (used by memset below) */ + case PGM: case PPM: + pixelmax = nextint("pixelmax integer"); + if (pixelmax > 255) panic("pixelmax larger than 255"); + } + if (getchar() != '\n') + panic("something not a simple newline after width height [pixelmax]"); + + /* allocate pixel line */ + switch (which) { + case PBM: linelength = (width + 7) / 8; break; + case PGM: linelength = width; break; + case PPM: linelength = width * 3; break; + } + line = (char*)malloc(linelength); + if (!line) panic("could not allocate pixel line"); + whiteline = (char*)malloc(linelength); + if (!whiteline) panic("could not allocate white pixel line"); + memset(whiteline, pixelmax, linelength); + + /* skip white pixel lines */ + newheight = height; + while (fread(line, linelength, 1, stdin) + && !memcmp(line, whiteline, linelength)) { + newheight--; + if (newheight <= 0) panic("entire image blank"); + } + + /* output revised header */ + if (newheight < height) + fprintf(stderr,"%s: cropping %d rows off the top\n", me, height-newheight); + printf("%.*s\n%d %d\n", MAGICSIZE, magic, width, newheight); + switch (which) { + case PBM: break; + case PGM: case PPM: + printf("%d\n", pixelmax); break; + } + + /* output remainder of image */ + do { + if (!fwrite(line, linelength, 1, stdout)) panic("could not write"); + } while (fread(line, linelength, 1, stdin)); + if (!feof(stdin)) panic("input not exhausted"); + + return(0); +} + + +/* +** $Log: pnmrawtopcropwhite.c,v $ +** Revision 3.9 2010/06/10 18:45:49 krisrose +** Reference to GPL by URL. +** +** Revision 3.8 2010/04/16 06:06:51 krisrose +** Preparing for a new release... +** +** Revision 3.7 1999/02/16 15:12:50 krisrose +** Interim release (Y&Y fonts now free). +** +** Revision 1.3 1997/05/01 20:59:51 krisrose +** Works for all three raw formats now. +** +** Revision 1.2 1997/05/01 17:34:58 krisrose +** Extended to raw PGM and PPM in addition to PBM. +** +** Revision 1.1 1997/04/30 21:30:31 krisrose +** Initial revision +*/ |