1#!/bin/sh
2#
3# $Id: ieee-copyout.in,v 1.2 2006/02/01 14:33:24 dan Exp $
4#
5# Copyright (c) 2002 Dan McMahill
6# All rights reserved.
7#
8# This code is derived from software written by Dan McMahill
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions
12# are met:
13# 1. Redistributions of source code must retain the above copyright
14#    notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright
16#    notice, this list of conditions and the following disclaimer in the
17#    documentation and/or other materials provided with the distribution.
18# 3. All advertising materials mentioning features or use of this software
19#    must display the following acknowledgement:
20#        This product includes software developed by Dan McMahill
21#  4. The name of the author may not be used to endorse or promote products
22#     derived from this software without specific prior written permission.
23#
24#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25#  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26#  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27#  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30#  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31#  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32#  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33#  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34#  SUCH DAMAGE.
35#
36
37#
38# This script will be used for creating an archive of the format that
39# the IEEE wants for paper submissions
40#
41
42echo "$0 has not been completed yet.  Feel free to finish writing"
43echo "it and submit the new code."
44exit 1
45
46VERSION=@VERSION@
47
48MAXITERS=${MAXITERS:-5}
49LATEX=${LATEX:-latex}
50BIBTEX=${BIBTEX:-bibtex}
51IEEE_COPYOUT_LOG=${LOG:-ieee-copyout.log}
52
53SED_FILE=ieee-copyout.sed.$$$$
54if [ -f $SED_FILE ]; then
55    rm -f $SED_FILE
56fi
57
58sep="------------------------------------"
59
60while test -n "$1"
61do
62	case "$1"
63	in
64
65	--clean)
66		if [ -f $IEEE_COPYOUT_LOG ]; then
67		    rm -f $IEEE_COPYOUT_LOG
68		fi
69		exit 0
70		;;
71
72	--version)
73		echo "ieee-copyout version $VERSION (part of LaTeX-Mk)"
74		exit 0
75		;;
76
77	-*)
78		echo "unknown option: $1"
79		exit 1
80		;;
81
82	*)
83		break
84		;;
85
86	esac
87done
88
89INFILE=$1
90
91if test -z "$INFILE" ; then
92	echo "$0:   You must specify an input file"
93	exit 1
94fi
95
96if test ! -f "${INFILE}" ; then
97    INFILE=${INFILE}.tex
98fi
99if test ! -f "${INFILE}" ; then
100	echo "$0:   Neither ${INFILE} nor ${INFILE}.tex exists"
101	exit 1
102fi
103NAME=`basename ${INFILE} .tex`
104
105
106$ndir=/tmp/foo
107rm -f $ndir/*
108if [ ! -d $ndir ]; then
109    mkdir -p $ndir
110fi
111
112echo Processing figures
113i=1
114for f in `awk 'BEGIN{FS="[{}]+";} /^\\includegraphics/ {print $2;}' ${NAME}.tex`
115do
116
117    nf=fig${i}.eps
118    echo "Renaming $f to $nf"
119    echo "s;{$f};{$nf};g" >> $SED_FILE
120    cp $f $ndir/$nf
121
122    i=`expr $i + 1`
123done
124
125set -x
126sed -f $SED_FILE $tf | awk '/@docstart@/,/@bibstart@/ {print}' > $ndir/${ntf}.tex
127cat jssc_autocal.bbl >> $ndir/${ntf}.tex
128sed -f $SED_FILE $tf | awk '/@bibend@/,/@docend@/ {print}' >> $ndir/${ntf}.tex
129cp IEEEtran.cls $ndir
130
131cat > $ndir/README.txt <<EOF
132
133EOF
134exit 0
135
136