The R Project SVN R

Rev

Rev 47905 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 47905 Rev 47912
Line 3... Line 3...
3
## Examples:
3
## Examples:
4
##  R CMD Rd2dvi /path/to/Rsrc/src/library/base/man/Normal.Rd
4
##  R CMD Rd2dvi /path/to/Rsrc/src/library/base/man/Normal.Rd
5
##  R CMD Rd2dvi `grep -l "\\keyword{distr" \
5
##  R CMD Rd2dvi `grep -l "\\keyword{distr" \
6
##                  /path/to/Rsrc/src/library/stats/man/*.Rd | sort | uniq`
6
##                  /path/to/Rsrc/src/library/stats/man/*.Rd | sort | uniq`
7
 
7
 
8
revision='$Rev: 47905 $'
8
revision='$Rev: 47912 $'
9
version=`set - ${revision}; echo ${2}`
9
version=`set - ${revision}; echo ${2}`
10
version="Rd2dvi: ${R_VERSION} (r${version})
10
version="Rd2dvi: ${R_VERSION} (r${version})
11
 
11
 
12
Copyright (C) 2000-2009 The R Core Development Team.
12
Copyright (C) 2000-2009 The R Core Development Team.
13
This is free software; see the GNU General Public License version 2
13
This is free software; see the GNU General Public License version 2
Line 55... Line 55...
55
unset CDPATH
55
unset CDPATH
56
 
56
 
57
start_dir=`pwd`
57
start_dir=`pwd`
58
build_dir=".Rd2dvi${$}"
58
build_dir=".Rd2dvi${$}"
59
 
59
 
-
 
60
title=""
60
batch=false
61
batch=false
61
clean=true
62
clean=true
62
debug=false
63
debug=false
63
only_meta=false
64
only_meta=false
64
out_ext="dvi"
65
out_ext="dvi"
Line 145... Line 146...
145
  shift
146
  shift
146
done
147
done
147
 
148
 
148
if ${debug}; then set -x; fi
149
if ${debug}; then set -x; fi
149
 
150
 
150
. ${R_SHARE_DIR}/sh/dcf.sh	# get_dcf_field()
-
 
151
 
-
 
152
 
-
 
153
do_cleanup () {
151
do_cleanup () {
154
  if ${clean}; then
152
  if ${clean}; then
155
    cd ${start_dir}
153
    cd ${start_dir}
156
    rm -rf ${build_dir}
154
    rm -rf ${build_dir}
157
  else
155
  else
158
    echo "You may want to clean up by 'rm -rf ${build_dir}'"
156
    echo "You may want to clean up by 'rm -rf ${build_dir}'"
159
  fi
157
  fi
160
}
158
}
161
 
159
 
162
is_bundle=no
160
is_bundle=no
163
file_sed='s/[_$]/\\&/g'
-
 
164
 
161
 
165
if test -d "${1}"; then
162
if test -d "${1}"; then
166
  if test -f ${1}/DESCRIPTION; then
163
  if test -f ${1}/DESCRIPTION; then
167
    if test -n "`grep '^Bundle:' ${1}/DESCRIPTION`"; then
164
    if test -n "`grep '^Bundle:' ${1}/DESCRIPTION`"; then
168
      echo "Hmm ... looks like a package bundle"
165
      echo "Hmm ... looks like a package bundle"
169
      is_bundle=yes
166
      is_bundle=yes
170
      bundle_name=`get_dcf_field Bundle "${1}/DESCRIPTION"`
-
 
171
      title=${title-"Bundle \`${bundle_name}'"}
-
 
172
    else
167
    else
173
      echo "Hmm ... looks like a package"
168
      echo "Hmm ... looks like a package"
174
      package_name=`get_dcf_field Package "${1}/DESCRIPTION"`
-
 
175
      title=${title-"Package \`${package_name}'"}
-
 
176
      dir=${1}
169
      dir=${1}
177
    fi
170
    fi
178
    test -z "${output}" && output="`basename ${1}`.${out_ext}"
171
    test -z "${output}" && output="`basename ${1}`.${out_ext}"
179
  elif test -f ${1}/DESCRIPTION.in && \
172
  elif test -f ${1}/DESCRIPTION.in && \
180
       test -n "`grep '^Priority: *base' ${1}/DESCRIPTION.in`"; then
173
       test -n "`grep '^Priority: *base' ${1}/DESCRIPTION.in`"; then
181
    echo "Hmm ... looks like a package from the R distribution"
174
    echo "Hmm ... looks like a package from the R distribution"
182
    package_name=`get_dcf_field Package "${1}/DESCRIPTION.in"`
-
 
183
    title=${title-"Package \`${package_name}'"}
-
 
184
    dir=${1}
175
    dir=${1}
185
    test -z "${output}" && output="`basename ${1}`.${out_ext}"
176
    test -z "${output}" && output="`basename ${1}`.${out_ext}"
186
  else
177
  else
187
    if test -d ${1}/man; then
178
    if test -d ${1}/man; then
188
      dir=${1}/man
179
      dir=${1}/man
189
    else
180
    else
190
      dir=${1}
181
      dir=${1}
191
    fi
182
    fi
192
    subj0=`${echo} ${dir} | ${SED} -e ${file_sed}`
-
 
193
    subj="all in \\\\\\\\file{${subj0}}"
-
 
194
  fi
183
  fi
195
else
184
else
196
  if test ${#} -gt 1 ; then
185
  if test ${#} -eq 1 ; then
197
    subj=" etc.";
-
 
198
  else
-
 
199
    subj=
-
 
200
    if test -z "${output}"; then
186
    if test -z "${output}"; then
201
      output=`basename "${1}"`
187
      output=`basename "${1}"`
202
      output="`echo ${output} | ${SED} 's/[Rr]d$//'`${out_ext}"
188
      output="`echo ${output} | ${SED} 's/[Rr]d$//'`${out_ext}"
203
    fi
189
    fi
204
  fi
190
  fi
205
  subj0=`${echo} ${1} | ${SED} -e ${file_sed}`
-
 
206
  subj="\\\\\\\\file{${subj0}}${subj}"
-
 
207
fi
191
fi
208
 
192
 
209
 
-
 
210
## substitution went wrong under ash
-
 
211
title1="\\\\\\\\R{} documentation}} \\\\\\\\par\\\\\\\\bigskip{{''\\\\\\\\Large of ${subj}"
-
 
212
title=${title-$title1}
-
 
213
 
-
 
214
 
-
 
215
## Prepare for building the documentation.
193
## Prepare for building the documentation.
216
if test -z "${output}"; then
194
if test -z "${output}"; then
217
  output="Rd2.${out_ext}"
195
  output="Rd2.${out_ext}"
218
fi
196
fi
219
if test -f ${output}; then
197
if test -f ${output}; then