Date:2010-08-30 08:14:07 (13 years 6 months ago)
Author:Werner Almesberger
Commit:337f13a0df4fdcf621e5d9137bf7b1655bd7e993
Message:Sheet names now link to the sheet's PDF.

- scripts/normalizeschps: by default, don't change the linewidth
- scripts/schhist2web: cache historical Postscript files in directories
ps_*
- scripts/schps2pdf: new script to convert eeschema Postscript to PDF
- scripts/schhist2web: link the file name in the title to the curent
PDF of the respective sheet
- scripts/Makefile: changed lazy wildcard thum* to thumb_* and diff* to
diff_*
- scripts/Makefile: upload also pdf_*
Files: scripts/Makefile (1 diff)
scripts/normalizeschps (2 diffs)
scripts/schhist2web (3 diffs)
scripts/schps2pdf (1 diff)

Change Details

scripts/Makefile
11SHELL = /bin/bash
22
3UPLOAD = {index.html,unchanged.png,thum*,diff*}
3UPLOAD = {index.html,unchanged.png,thumb_*,diff_*,pdf_*}
44DEST = werner@host:/home/httpd/almesberger/misc/ben/
55RSYNC = rsync -a --progress
66
scripts/normalizeschps
1212#
1313
1414
15LINEWIDTH=120
16
17
1815usage()
1916{
2017    cat <<EOF 1>&2
2118usage: $0 [options] [in.ps [out.ps]]
2219
23  -w points Postscript line width (default: $LINEWIDTH)
20  -w points Postscript line width (default: use the original)
2421EOF
2522    exit 1
2623}
2724
2825
26width=
2927while true; do
3028    case "$1" in
3129    -w) [ -z "$2" ] && usage
32    LINEWIDTH="$2"
30    width="$2"
3331    shift 2;;
3432    -*)
3533    usage;;
...... 
4543sed '
4644  1c%!PS-Adobe-3.0\
4745  currentdict /DidNormalize known not { \
48      /setlinewidth { '$LINEWIDTH' 2 copy lt { exch } if pop \
49        setlinewidth } bind def \
46      '"`[ -z \"$width\" ] ||
47        echo \"/setlinewidth { $width 2 copy lt { exch } if pop \
48        setlinewidth } bind def \"`"' \
5049      /rectfill { rectstroke } bind def \
5150      /DidNormalize true def \
5251  } if \
scripts/schhist2web
193193    tmp=`pwd`/_schhist2web
194194    trap "rm -rf \"$cache/ppm_$n\" \"$cache/fat_$n\" \"$tmp\"" 0
195195    if [ ! -d "$cache/ppm_$n" ]; then
196    rm -rf "$cache/ppm_$n" "$cache/fat_$n"
197    mkdir "$cache/ppm_$n" "$cache/fat_$n"
196    rm -rf "$cache/ppm_$n" "$cache/fat_$n" "$cache/ps_$n"
197    mkdir "$cache/ppm_$n" "$cache/fat_$n" "$cache/ps_$n"
198198    #
199199    # potential optimization here: remember Postscript files from previous
200200    # run (or their md5sum) and check if they have changed. If not, skip
...... 
204204    gitsch2ps $sanitize "$dir" "$schname" $n "$tmp" || exit
205205    for m in "$tmp"/*.ps; do
206206        ppm="$cache/ppm_$n/`basename "$m" .ps`.ppm"
207        normalizeschps "$m" | schps2ppm - "$ppm" || exit
207        normalizeschps -w 120 "$m" | schps2ppm - "$ppm" || exit
208208        ppm="$cache/fat_$n/`basename "$m" .ps`.ppm"
209209        normalizeschps -w 500 "$m" | schps2ppm - "$ppm" || exit
210        ps="$cache/ps_$n/`basename "$m"`"
211        normalizeschps "$m" "$ps" || exit
210212    done
211213    rm -rf "$tmp"
212214    fi
...... 
257259<TR bgcolor="$FNAME_COLOR">
258260EOF
259261    while read m; do
260    echo "<TD><B>$m</B>"
262    mkdir -p "$out/pdf_$head"
263    schps2pdf -o "$out/pdf_$head/$m.pdf" "$cache/ps_$head/$m.ps" || exit
264    echo "<TD><A href="pdf_$head/$m.pdf"><B>$m</B></A>"
261265    done < <(ls -1 "$out/names")
262266} >"$index"
263267
scripts/schps2pdf
1#!/bin/bash
2#
3# schps2pdf - Generate PDF files from Eeschema Postscript
4#
5# Written 2010 by Werner Almesberger
6# Copyright 2010 Werner Almesberger
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13
14
15usage()
16{
17    cat <<EOF 1>&2
18usage: $0 [options] [-o file.pdf] [file.ps ...]
19
20  -t prefix make a table of content. Remove prefix from file names.
21EOF
22    exit 1
23}
24
25
26toc=false
27out=-
28while true; do
29    case "$1" in
30    -o) [ -z "$2" ] && usage
31    out=$2
32    shift 2;;
33    -t) [ -z "$2" ] && usage
34    toc=true
35    prefix="$1"
36    shift 2;;
37    -*)
38    usage;;
39    *)
40    break;;
41    esac
42done
43
44in=${1:--}
45shift
46
47cat "$in" |
48  eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\""$out\"" -f \
49    `for n in "$in" "$@"; do \
50      name=\`basename "$n" .ps\` \
51      echo "<($toc && echo '[ /Title (${name#$prefix}) /OUT pdfmark';
52      cat \"$n\";)"; done`

Archive Download the corresponding diff file



interactive