The R Project SVN R

Rev

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

Rev 11368 Rev 11629
Line 1... Line 1...
1
#! @PERL@
1
#! @PERL@
2
#-*- perl -*- (for Rdconv.in ..)
2
#-*- perl -*- (for Rdconv.in ..)
3
 
3
 
4
# Convert R documentation into HTML, LaTeX and text format
4
## Convert R documentation into HTML, LaTeX and text format
5
 
5
 
6
# Copyright (C) 1997 Friedrich Leisch
6
# Copyright (C) 1997 Friedrich Leisch
-
 
7
# Copyright (C) 2000 The R Core Development Team
7
#
8
#
8
# This program is free software; you can redistribute it and/or modify
9
# 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
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2, or (at your option)
11
# the Free Software Foundation; either version 2, or (at your option)
11
# any later version.
12
# any later version.
Line 18... Line 19...
18
# A copy of the GNU General Public License is available via WWW at
19
# A copy of the GNU General Public License is available via WWW at
19
# http://www.gnu.org/copyleft/gpl.html.	 You can also obtain it by
20
# http://www.gnu.org/copyleft/gpl.html.	 You can also obtain it by
20
# writing to the Free Software Foundation, Inc., 59 Temple Place,
21
# writing to the Free Software Foundation, Inc., 59 Temple Place,
21
# Suite 330, Boston, MA  02111-1307  USA.
22
# Suite 330, Boston, MA  02111-1307  USA.
22
 
23
 
23
# Send any bug reports to Friedrich.Leisch@ci.tuwien.ac.at
24
# Send any bug reports to r-bugs@r-project.org.
24
 
25
 
25
use Getopt::Long;
26
use Getopt::Long;
26
use R::Rdconv;
27
use R::Rdconv;
-
 
28
use R::Utils;
27
 
29
 
28
my $revision = ' $Revision: 1.17 $ ';
30
my $revision = ' $Revision: 1.17.2.1 $ ';
29
my $version;
31
my $version;
30
my $name;
32
my $name;
31
 
33
 
32
$revision =~ / ([\d\.]*) /;
34
$revision =~ / ([\d\.]*) /;
33
$version = $1;
35
$version = $1;
34
($name = $0) =~ s|.*/||;
36
($name = $0) =~ s|.*/||;
35
 
37
 
36
sub version {
-
 
37
  print STDERR <<END;
-
 
38
Rdconv $version
-
 
39
Copyright (C) 1997-2000 R Core Development Team
-
 
40
This is free software; see the GNU General Public Licence version 2
-
 
41
or later for copying conditions.  There is NO warranty.    
-
 
42
END
-
 
43
  exit 0;
-
 
44
}
-
 
45
 
-
 
46
sub usage {
38
sub usage {
47
  print STDERR <<END;
39
  print STDERR <<END;
48
Usage: R CMD Rdconv [options] FILE
40
Usage: R CMD Rdconv [options] FILE
49
 
41
 
50
Convert R documentation in FILE to other formats such as plain text,
42
Convert R documentation in FILE to other formats such as plain text,
Line 53... Line 45...
53
Options:
45
Options:
54
  -h, --help		print short help message and exit
46
  -h, --help		print short help message and exit
55
  -v, --version		print version info and exit
47
  -v, --version		print version info and exit
56
  -d, --debug		turn on debugging (increase verbosity)
48
  -d, --debug		turn on debugging (increase verbosity)
57
  -t, --type=TYPE	convert to format TYPE
49
  -t, --type=TYPE	convert to format TYPE
58
  -o, --output-file=fn	use \`fn\' as the output file
50
  -o, --output=OUT	use \`OUT\' as the output file
59
  --os=NAME		use OS subdir \`NAME\' (unix, mac or windows)
51
      --os=NAME		use OS subdir \`NAME\' (unix, mac or windows)
60
  --OS=NAME		the same as --os.
52
      --OS=NAME		the same as \`--os\'.
61
 
53
 
62
Possible format specifications are txt (plain text), html, latex,
54
Possible format specifications are \`txt\' (plain text), \`html\',
63
Sd (S documentation format), and example (extract R code in the examples).
55
\`latex\', \`Sd\' (S documentation format), and \`example\' (extract R
-
 
56
code in the examples).
64
 
57
 
65
The default is to send output to stdout, which is also given by -o -.
58
The default is to send output to stdout, which is also given by \`-o -\'.
66
Using -o \"\" will choose an output filename by removing a .Rd extension
59
Using \`-o \"\"\' will choose an output filename by removing a \`.Rd\'
67
from FILE and adding a suitable extension.
60
extension from FILE and adding a suitable extension.
68
  
61
  
69
Email bug reports to <r-bugs\@r-project.org>.
62
Email bug reports to <r-bugs\@r-project.org>.
70
END
63
END
71
  exit 0;
64
  exit 0;
72
}
65
}
73
 
66
 
74
$OSdir ="unix";
67
$OSdir ="unix";
75
 
68
 
76
 
-
 
77
@knownoptions = ("debug|d", "type|t:s", "h|help", "v|version", 
69
@knownoptions = ("debug|d", "type|t:s", "h|help", "v|version", 
78
		 "o|output-file:s", "os|OS:s");
70
		 "o|output:s", "os|OS:s");
79
GetOptions (@knownoptions) || &usage();
71
GetOptions (@knownoptions) || &usage();
80
&version() if $opt_v;
72
&R_version($name, $version) if $opt_v;
81
&usage() if $opt_h;
73
&usage() if $opt_h;
82
 
74
 
83
$OSdir = $opt_os if $opt_os;
75
$OSdir = $opt_os if $opt_os;
84
$out = 0;
76
$out = 0;
85
if(defined $opt_o) {
77
if(defined $opt_o) {