2016-07-25 23:42:50 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
2016-07-26 08:32:53 +03:00
|
|
|
cat <<EOF 1>&2
|
|
|
|
usage: $0 [-o output.pdf] [-q] [-t template.fig ] file.lib ... file.sch
|
|
|
|
EOF
|
2016-07-25 23:42:50 +03:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
out=out.pdf
|
|
|
|
quiet=false
|
2016-07-26 08:32:53 +03:00
|
|
|
template=
|
2016-07-25 23:42:50 +03:00
|
|
|
while [ "$1" ]; do
|
|
|
|
case "$1" in
|
|
|
|
-o) out=$2
|
|
|
|
shift 2;;
|
|
|
|
-q) quiet=true
|
|
|
|
shift;;
|
2016-07-26 08:32:53 +03:00
|
|
|
-t) template="-t $2"
|
|
|
|
shift 2;;
|
2016-07-25 23:42:50 +03:00
|
|
|
-*) usage;;
|
|
|
|
*) break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
[ "$1" ] || usage
|
|
|
|
|
|
|
|
libs=
|
|
|
|
while [ "$2" ]; do
|
|
|
|
libs="$libs $1"
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
cmd=
|
|
|
|
first=true
|
|
|
|
for n in `sed '/\$Sheet/,/\$EndSheet/p;d' "$1" |
|
|
|
|
sed '/F1 "\([^"]*\)" .*/s//\1/p;d'`; do
|
|
|
|
$quiet || echo "$n" 1>&2
|
2016-07-26 08:32:53 +03:00
|
|
|
./sch2fig $template $libs `dirname "$1"`/$n | fig2dev -L pdf >_tmp.pdf
|
2016-07-25 23:42:50 +03:00
|
|
|
if $first; then
|
|
|
|
mv _tmp.pdf "$out"
|
|
|
|
first=false
|
|
|
|
else
|
2016-07-26 08:32:53 +03:00
|
|
|
pdfunite "$out" _tmp.pdf _tmp2.pdf
|
2016-07-25 23:42:50 +03:00
|
|
|
mv _tmp2.pdf "$out"
|
|
|
|
fi
|
|
|
|
done
|