summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-03-21 17:22:48 +0000
committerKarl Berry <karl@freefriends.org>2011-03-21 17:22:48 +0000
commit40c3c9626d2ff87ef13711353b6e94c3b199c05b (patch)
tree077bc2e170a4649ab31a426da0bde2116e402d4a /Master
parenta7bf6f6e627d298be092740db7f84e1a23493702 (diff)
new script texdef (6mar11)
git-svn-id: svn://tug.org/texlive/trunk@21783 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
l---------Master/bin/alpha-linux/texdef1
l---------Master/bin/amd64-freebsd/texdef1
l---------Master/bin/amd64-kfreebsd/texdef1
l---------Master/bin/i386-cygwin/texdef1
l---------Master/bin/i386-freebsd/texdef1
l---------Master/bin/i386-kfreebsd/texdef1
l---------Master/bin/i386-linux/texdef1
l---------Master/bin/i386-netbsd/texdef1
l---------Master/bin/i386-solaris/texdef1
l---------Master/bin/mips-irix/texdef1
l---------Master/bin/powerpc-aix/texdef1
l---------Master/bin/powerpc-linux/texdef1
l---------Master/bin/sparc-linux/texdef1
l---------Master/bin/sparc-solaris/texdef1
l---------Master/bin/universal-darwin/texdef1
-rwxr-xr-xMaster/bin/win32/texdef.exebin0 -> 1536 bytes
l---------Master/bin/x86_64-darwin/texdef1
l---------Master/bin/x86_64-linux/texdef1
l---------Master/bin/x86_64-solaris/texdef1
-rw-r--r--Master/texmf-dist/doc/support/texdef/INSTALL59
-rw-r--r--Master/texmf-dist/doc/support/texdef/README64
-rwxr-xr-xMaster/texmf-dist/scripts/texdef/texdef.pl419
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds103
-rw-r--r--Master/tlpkg/tlpsrc/collection-binextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/texdef.tlpsrc1
26 files changed, 632 insertions, 35 deletions
diff --git a/Master/bin/alpha-linux/texdef b/Master/bin/alpha-linux/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/alpha-linux/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/amd64-freebsd/texdef b/Master/bin/amd64-freebsd/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/amd64-freebsd/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/amd64-kfreebsd/texdef b/Master/bin/amd64-kfreebsd/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/amd64-kfreebsd/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/i386-cygwin/texdef b/Master/bin/i386-cygwin/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/i386-cygwin/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/i386-freebsd/texdef b/Master/bin/i386-freebsd/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/i386-freebsd/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/i386-kfreebsd/texdef b/Master/bin/i386-kfreebsd/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/i386-kfreebsd/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/i386-linux/texdef b/Master/bin/i386-linux/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/i386-linux/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/i386-netbsd/texdef b/Master/bin/i386-netbsd/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/i386-netbsd/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/i386-solaris/texdef b/Master/bin/i386-solaris/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/i386-solaris/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/mips-irix/texdef b/Master/bin/mips-irix/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/mips-irix/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/powerpc-aix/texdef b/Master/bin/powerpc-aix/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/powerpc-aix/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/powerpc-linux/texdef b/Master/bin/powerpc-linux/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/powerpc-linux/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/sparc-linux/texdef b/Master/bin/sparc-linux/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/sparc-linux/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/sparc-solaris/texdef b/Master/bin/sparc-solaris/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/sparc-solaris/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/universal-darwin/texdef b/Master/bin/universal-darwin/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/universal-darwin/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/win32/texdef.exe b/Master/bin/win32/texdef.exe
new file mode 100755
index 00000000000..5777d90a17a
--- /dev/null
+++ b/Master/bin/win32/texdef.exe
Binary files differ
diff --git a/Master/bin/x86_64-darwin/texdef b/Master/bin/x86_64-darwin/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/x86_64-darwin/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/x86_64-linux/texdef b/Master/bin/x86_64-linux/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/x86_64-linux/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/bin/x86_64-solaris/texdef b/Master/bin/x86_64-solaris/texdef
new file mode 120000
index 00000000000..66300737516
--- /dev/null
+++ b/Master/bin/x86_64-solaris/texdef
@@ -0,0 +1 @@
+../..//scripts/texdef/texdef.pl \ No newline at end of file
diff --git a/Master/texmf-dist/doc/support/texdef/INSTALL b/Master/texmf-dist/doc/support/texdef/INSTALL
new file mode 100644
index 00000000000..61e8e803059
--- /dev/null
+++ b/Master/texmf-dist/doc/support/texdef/INSTALL
@@ -0,0 +1,59 @@
+Installation
+============
+
+Requirements
+------------
+
+The `texdef` program is a Perl script which needs a Perl interpreter to work.
+Informations about installing Perl can be found at http://www.perl.org/get.html.
+
+The script calls a TeX compiler (tex, latex, ...) to display the definition of commands/macros.
+Therefore (La)TeX must also be installed.
+Informations about installing (La)TeX can be found at http://www.latex-project.org/ftp.html.
+
+
+Location
+--------
+
+For installation the script 'texdef.pl' must simply be copied to a location suitable for executables,
+i.e. a directory in the PATHi, e.g. '/usr/bin' or '/usr/local/bin' for Linux/Unix.
+
+The script should be set as "executable", i.e. 'chmod +x texdef.pl' for Linux/Unix.
+This is not required for MS Windows.
+
+
+Name
+----
+
+This script can show the definitions of commands with different flavours of TeX
+(tex, etex, latex, pdftex, pdfetex, pdflatex, xetex, xelatex, context, ...).
+The flavour can be given using an command line option or over the _script name_,
+i.e. if the script is called 'texdef' it will use 'tex', but called 'latexdef'
+it will use 'latex' and so on.
+The script can be simply copied several times, but creating _symbolic links_
+to the real script is enough on operation systems / file systems which support
+this.
+
+At least the two variations 'texdef' and 'latexdef' should be installed.
+
+
+Quick Install Nodes for Linux/Unix
+----------------------------------
+
+ cp texdef.pl /usr/local/bin/
+ cd /usr/local/bin
+ ln -s texdef.pl texdef
+ ln -s texdef.pl latexdef
+ ln -s texdef.pl etexdef
+ ln -s texdef.pl luatexdef
+ ln -s texdef.pl lualatexdef
+ ln -s texdef.pl pdftexdef
+ ln -s texdef.pl pdflatexdef
+ ln -s texdef.pl xetexdef
+ ln -s texdef.pl xelatexdef
+ ln -s texdef.pl 'some other TeX flavour of your choice'
+
+or use the Makefile (defaults to `/usr/local/bin`)
+
+ make install INSTALLDIR=/your/path
+
diff --git a/Master/texmf-dist/doc/support/texdef/README b/Master/texmf-dist/doc/support/texdef/README
new file mode 100644
index 00000000000..f4d2f601fb4
--- /dev/null
+++ b/Master/texmf-dist/doc/support/texdef/README
@@ -0,0 +1,64 @@
+texdef -- Show definitions of TeX commands
+
+This perl script shows the definition of (La)TeX commands in a similar way as `\show`.
+
+
+Version 1.0 -- 2011/03/05
+Copyright (C) 2011 Martin Scharrer <martin@scharrer-online.de>
+This program comes with ABSOLUTELY NO WARRANTY;
+This is free software, and you are welcome to redistribute it under certain conditions;
+
+Usage:
+ texdef [options] commandname [commandname ...]
+ latexdef [options] commandname [commandname ...]
+
+Other program names are possible. See the 'tex' option. Command names do not need to start with `\`.
+
+Options:
+ --tex <flv>, -t <flv> : Use given flavour of TeX: 'tex', 'latex', 'context'.
+ Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported.
+ The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc.
+ --value, -v : Show value of command instead (i.e. \the\command).
+ --preamble, -P : Show definition of the command inside the preamble.
+ --beforeclass, -B : Show definition of the command before \documentclass.
+ --package <pkg>, -p <pkg> : (M) Load given tex-file, package or module depending on whether '*tex', '*latex'
+ or 'context' is used. For LaTeX the <pkg> can start with `[<options>]` and end
+ with `<pkgname>` or `{<pkgname>}`.
+ --class <class>, -c <class> : (LaTeX only) Load given class instead of default ('article').
+ The <class> can start with `[<classs options>]` and end
+ with `<classname>` or `{<classname>}`.
+ --environment <env>, -p <env> : (M) Show definition inside the given environment <env>.
+ --othercode <code>, -o <code> : (M) Add other code into the preamble before the definition is shown.
+ This can be used to e.g. load PGF/TikZ libraries.
+ --before <code>, -b <code> : (M) Place <code> before definition is shown.
+ The <code> can be arbitray TeX code and doesn't need be be balanced.
+ --after <code>, -a <code> : (M) Place <code> after definition is shown.
+ The <code> can be arbitray TeX code and doesn't need be be balanced.
+ --help, -h : Print this help and quit.
+
+ Long option can be shorten as long the are still unique. Short options can be combined.
+ If the option 'environment', 'before' and 'after' are used toegether the
+ produced code will be inserted in the given order (reversed order for 'after').
+ (M) = This option can be given multiple times.
+
+Examples:
+Show the definition of '\chapter' with different classes ('article' (default), 'book' and 'scrbook'):
+
+ latexdef chapter
+ latexdef -c book chapter
+ latexdef -c scrbook chapter
+
+Show value of `\textwidth` with different class options:
+
+ latexdef -c [a4paper]{book} -v paperwidth
+ latexdef -c [letter]{book} -v paperwidth
+
+Show definition of TikZ's '\draw' outside and inside a 'tikzpicture' environment:
+
+ latexdef -p tikz draw
+ latexdef -p tikz --env tikzpicture draw
+
+Show definition of TikZ's '\draw' inside a node, inside a 'beamer' frame in 'handout' mode:
+
+ latexdef -c [handout]beamer -p tikz --env frame --env tikzpicture -b '\node {' -a '};' draw
+
diff --git a/Master/texmf-dist/scripts/texdef/texdef.pl b/Master/texmf-dist/scripts/texdef/texdef.pl
new file mode 100755
index 00000000000..2cba8798b72
--- /dev/null
+++ b/Master/texmf-dist/scripts/texdef/texdef.pl
@@ -0,0 +1,419 @@
+#!/usr/bin/env perl
+################################################################################
+# texdef -- Show definitions of TeX commands
+# Copyright (c) 2011 Martin Scharrer <martin@scharrer-online.de>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+################################################################################
+use strict;
+use warnings;
+use File::Temp qw/tempdir/;
+use File::Basename;
+use Cwd;
+
+my ($scriptname) = fileparse($0, qw(\.pl \.perl));
+
+my $TEX = 'pdflatex';
+if ($scriptname =~ /^(.*)def$/) {
+ $TEX = $1;
+}
+
+my $CLASS = "article";
+my @PACKAGES = ();
+my @OTHERDEFS = ();
+my $INPREAMBLE = 0;
+my $SHOWVALUE = 0;
+my $BEFORECLASS = 0;
+my @ENVCODE = ();
+
+use Getopt::Long;
+my $data = "file.dat";
+my $length = 24;
+my $verbose;
+
+my $ISLATEX = 0;
+my $ISTEX = 0;
+my $ISCONTEXT = 0;
+
+my $BEGINENVSTR = '%s';
+my $ENDENVSTR = '%s';
+
+sub usage {
+print << 'EOT';
+texdef -- Show definitions of TeX commands
+Version 1.1 -- 2011/03/16
+Copyright (C) 2011 Martin Scharrer <martin@scharrer-online.de>
+This program comes with ABSOLUTELY NO WARRANTY;
+This is free software, and you are welcome to redistribute it under certain conditions;
+
+Usage:
+ texdef [options] commandname [commandname ...]
+ latexdef [options] commandname [commandname ...]
+
+Other program names are possible. See the 'tex' option. Command names do not need to start with `\`.
+
+Options:
+ --tex <flv>, -t <flv> : Use given flavour of TeX: 'tex', 'latex', 'context'.
+ Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported.
+ The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc.
+ --value, -v : Show value of command instead (i.e. \the\command).
+ --preamble, -P : Show definition of the command inside the preamble.
+ --beforeclass, -B : Show definition of the command before \documentclass.
+ --package <pkg>, -p <pkg> : (M) Load given tex-file, package or module depending on whether '*tex', '*latex'
+ or 'context' is used. For LaTeX the <pkg> can start with `[<options>]` and end
+ with `<pkgname>` or `{<pkgname>}`.
+ --class <class>, -c <class> : (LaTeX only) Load given class instead of default ('article').
+ The <class> can start with `[<classs options>]` and end
+ with `<classname>` or `{<classname>}`.
+ --environment <env>, -p <env> : (M) Show definition inside the given environment <env>.
+ --othercode <code>, -o <code> : (M) Add other code into the preamble before the definition is shown.
+ This can be used to e.g. load PGF/TikZ libraries.
+ --before <code>, -b <code> : (M) Place <code> before definition is shown.
+ The <code> can be arbitray TeX code and doesn't need be be balanced.
+ --after <code>, -a <code> : (M) Place <code> after definition is shown.
+ The <code> can be arbitray TeX code and doesn't need be be balanced.
+ --help, -h : Print this help and quit.
+
+ Long option can be shorten as long the are still unique. Short options can be combined.
+ If the option 'environment', 'before' and 'after' are used toegether the
+ produced code will be inserted in the given order (reversed order for 'after').
+ (M) = This option can be given multiple times.
+
+Examples:
+Show the definition of '\chapter' with different classes ('article' (default), 'book' and 'scrbook'):
+
+ latexdef chapter
+ latexdef -c book chapter
+ latexdef -c scrbook chapter
+
+Show value of `\textwidth` with different class options:
+
+ latexdef -c [a4paper]{book} -v paperwidth
+ latexdef -c [letter]{book} -v paperwidth
+
+Show definition of TikZ's '\draw' outside and inside a 'tikzpicture' environment:
+
+ latexdef -p tikz draw
+ latexdef -p tikz --env tikzpicture draw
+
+Show definition of TikZ's '\draw' inside a node, inside a 'beamer' frame in 'handout' mode:
+
+ latexdef -c [handout]beamer -p tikz --env frame --env tikzpicture -b '\node {' -a '};' draw
+
+EOT
+ exit (1);
+}
+
+sub envcode {
+ my $opt = shift;
+ my $arg = shift;
+ push @ENVCODE, [ $opt, $arg ];
+}
+
+
+Getopt::Long::Configure ("bundling");
+GetOptions (
+ 'value|v!' => \$SHOWVALUE,
+ 'preamble|P!' => \$INPREAMBLE,
+ 'beforeclass|B!' => \$BEFORECLASS,
+ 'class|c=s' => \$CLASS,
+ 'package|p=s' => \@PACKAGES,
+ 'otherdefs|o=s' => \@OTHERDEFS,
+ 'environment|e=s' => \&envcode,
+ 'before|b=s' => \&envcode,
+ 'after|a=s' => \&envcode,
+ 'tex|t=s' => \$TEX,
+ 'help|h' => \&usage,
+) || usage();
+
+if ($TEX =~ /latex$/) {
+ $ISLATEX = 1;
+ $BEGINENVSTR = '\begin{%s}' . "\n";
+ $ENDENVSTR = '\end{%s}' . "\n";
+}
+elsif ($TEX =~ /tex$/) {
+ $ISTEX = 1;
+ $BEGINENVSTR = '\%s' . "\n";
+ $ENDENVSTR = '\end%s' . "\n";
+}
+elsif ($TEX =~ /context$/) {
+ $ISCONTEXT = 1;
+ $BEGINENVSTR = '\start%s' . "\n";
+ $ENDENVSTR = '\stop%s' . "\n";
+}
+
+$CLASS =~ /^(?:\[(.*)\])?{?(.*?)}?$/;
+$CLASS = $2;
+my $CLASSOPTIONS = $1 || '';
+
+
+my $cwd = getcwd();
+$ENV{TEXINPUTS} = $cwd . ':' . ($ENV{TEXINPUTS} || '');
+
+my $TMPDIR = tempdir( 'texdef_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+chdir $TMPDIR or die;
+my $TMPFILE = 'texdef.tex';
+
+my @cmds = @ARGV;
+
+sub testdef {
+ my $cmd = shift;
+ my $def = shift;
+ if ($def eq 'macro:->\@latex@error {Can be used only in preamble}\@eha ' && $cmd ne '\@notprerr') {
+ unshift @cmds, '^' . $cmd;
+ }
+ elsif ($def =~ /^(?:\\[a-z]+ )?macro:.*?>(.*)/) {
+ my $macrodef = $1;
+ if ($macrodef =~ /^\\protect (.*?) ?$/) {
+ my $protectedmacro = $1;
+ unshift @cmds, $protectedmacro;
+ }
+ elsif ($macrodef =~ /^\\x\@protect (.*?) ?\\protect (.*?) ?$/) {
+ my $protectedmacro = $2;
+ unshift @cmds, $protectedmacro;
+ }
+ elsif ($macrodef =~ /^\\\@protected\@testopt {?\\.*? }? *(\\\\.*?) /) {
+ unshift @cmds, $1;
+ }
+ elsif ($macrodef =~ /^\\\@testopt {?(\\.*?) }?/) {
+ unshift @cmds, $1;
+ }
+ }
+ elsif ($def =~ /^\\(char|mathchar)|(dimen|skip|muskip|count)\d/) {
+ unshift @cmds, '#' . $cmd;
+ }
+}
+
+my $bschar = 0;
+my $pcchar = 0;
+my $lbchar = 0;
+my $rbchar = 0;
+
+sub special_chars {
+ return if (!$bschar && !$pcchar && !$lbchar && !$rbchar);
+ print '\begingroup'."\n";
+ if ($bschar) {
+ print '\lccode`.=92 \lowercase{\expandafter\gdef\csname @backslashchar\endcsname{.}}'."\n";
+ }
+ if ($pcchar) {
+ print '\lccode`.=37 \lowercase{\expandafter\gdef\csname @percentchar\endcsname{.}}'."\n";
+ }
+ if ($lbchar) {
+ print '\lccode`.=123 \lowercase{\expandafter\gdef\csname @charlb\endcsname{.}}'."\n";
+ }
+ if ($rbchar) {
+ print '\lccode`.=125 \lowercase{\expandafter\gdef\csname @charrb\endcsname{.}}'."\n";
+ }
+ print '\endgroup'."\n";
+}
+
+
+while (my $cmd = shift @cmds) {
+
+next if $cmd eq '';
+my $origcmd = $cmd;
+my $showvalue;
+my $inpreamble;
+if (length ($cmd) > 1) {
+ $cmd =~ s/^([#^])?\\?//;
+ my $type = $1 || '';
+ $showvalue = $type eq '#';
+ $inpreamble = $type eq '^';
+}
+$bschar = $cmd =~ s/\\/\\csname\0\@backslashchar\\endcsname\0/g;
+$pcchar = $cmd =~ s/\%/\\csname\0\@percentchar\\endcsname\0/g;
+$lbchar = $cmd =~ s/\{/\\csname\0\@charlb\\endcsname\0/g;
+$rbchar = $cmd =~ s/\}/\\csname\0\@charrb\\endcsname\0/g;
+$cmd =~ s/\s/\\space /g;
+$cmd =~ s/\0/ /g;
+
+
+open (my $tmpfile, '>', $TMPFILE);
+select $tmpfile;
+
+print "\\nonstopmode\n";
+
+if ($ISLATEX) {
+ print "\\nofiles\n";
+ if (!$BEFORECLASS) {
+ print "\\documentclass[$CLASSOPTIONS]{$CLASS}\n";
+
+ foreach my $pkg (@PACKAGES) {
+ $pkg =~ /^(?:\[(.*)\])?{?(.*?)}?$/;
+ my ($pkgname,$pkgoptions) = ($2, $1 || '');
+ print "\\usepackage[$pkgoptions]{$pkgname}\n";
+ }
+ {
+ local $, = "\n";
+ print @OTHERDEFS, '';
+ }
+ print "\\begin{document}\n" unless $inpreamble || $INPREAMBLE;
+ }
+}
+elsif ($ISCONTEXT) {
+ foreach my $pkgname (@PACKAGES) {
+ print "\\usemodule[$pkgname]\n";
+ }
+ {
+ local $, = "\n";
+ print @OTHERDEFS, '';
+ }
+ &special_chars();
+ print "\\starttext\n" unless $inpreamble || $INPREAMBLE;
+}
+elsif ($ISTEX) {
+ foreach my $pkgname (@PACKAGES) {
+ print "\\input $pkgname.tex \n";
+ }
+ {
+ local $, = "\n";
+ print @OTHERDEFS, '';
+ }
+ &special_chars();
+}
+
+foreach my $envc (@ENVCODE) {
+ my ($envtype,$env) = @$envc;
+ if ($envtype eq 'environment') {
+ printf $BEGINENVSTR, $env;
+ }
+ elsif ($envtype eq 'before') {
+ print "$env\n";
+ }
+}
+
+print '\immediate\write0{==============================================================================}%'."\n";
+if (length ($cmd) > 1) {
+if ($showvalue || $SHOWVALUE) {
+ print '\immediate\write0{\string\the\expandafter\string\csname ', $cmd, '\endcsname}%'."\n";
+ print '\immediate\write0{------------------------------------------------------------------------------}%'."\n";
+ print '\immediate\write0{\expandafter\the\csname ', $cmd, '\endcsname}%'."\n";
+} else {
+ print '\begingroup';
+ print '\immediate\write0{\expandafter\string\csname ', $cmd, '\endcsname}%'."\n";
+ print '\immediate\write0{------------------------------------------------------------------------------}%'."\n";
+ print '\expandafter\endgroup\expandafter\immediate\expandafter\write\expandafter0\expandafter{\expandafter\meaning\csname ', $cmd, '\endcsname}%'."\n";
+}
+}
+else {
+if ($showvalue || $SHOWVALUE) {
+ print '\immediate\write0{\string\the\string\\', $cmd, '}%'."\n";
+ print '\immediate\write0{------------------------------------------------------------------------------}%'."\n";
+ print '\immediate\write0{\the\\', $cmd, '}%'."\n";
+} else {
+ print '\immediate\write0{\string\\', $cmd, '}%'."\n";
+ print '\immediate\write0{------------------------------------------------------------------------------}%'."\n";
+ print '\immediate\write0{\meaning\\', $cmd, '}%'."\n";
+}
+}
+print '\immediate\write0{==============================================================================}%'."\n";
+
+foreach my $envc (reverse @ENVCODE) {
+ my ($envtype,$env) = @$envc;
+ if ($envtype eq 'environment') {
+ printf $ENDENVSTR, $env;
+ }
+ elsif ($envtype eq 'after') {
+ print "$env\n";
+ }
+}
+
+if ($ISLATEX) {
+ print "\\documentclass[$CLASSOPTIONS]{$CLASS}\n" if $BEFORECLASS;
+ print "\\begin{document}\n" if $inpreamble || $INPREAMBLE || $BEFORECLASS;
+ print "\\end{document}\n";
+}
+elsif ($ISCONTEXT) {
+ print "\\starttext\n" if $inpreamble || $INPREAMBLE;
+ print "\\stoptext\n";
+}
+elsif ($ISTEX) {
+ print "\\bye\n";
+}
+
+close ($tmpfile);
+
+select STDOUT;
+
+open (my $texpipe, '-|', "$TEX '$TMPFILE' ");
+
+my $name = '';
+my $definition = '';
+my $errormsg = '';
+
+while (<$texpipe>) {
+ last if /^=+$/;
+ if ($_ =~ /^!\s*(.*)/ && !$errormsg) {
+ chomp;
+ my $line = $1;
+ $errormsg = $line;
+ while (length $line >= 79) {
+ $line = <$texpipe>;
+ chomp $line;
+ $errormsg .= $line;
+ }
+ }
+}
+while (<$texpipe>) {
+ last if /^-+$/;
+ next if /^$/;
+ chomp;
+ $name .= $_;
+}
+while (<$texpipe>) {
+ last if /^=+$/;
+ next if /^$/;
+ chomp;
+ $definition .= $_;
+ if ($_ =~ /^!\s*(.*)/ && !$errormsg) {
+ $errormsg = $1;
+ }
+}
+while (<$texpipe>) {
+ if ($_ =~ /^!\s*(.*)/ && !$errormsg) {
+ chomp;
+ my $line = $1;
+ $errormsg = $line;
+ while (length $line >= 79) {
+ $line = <$texpipe>;
+ chomp $line;
+ $errormsg .= $line;
+ }
+ }
+}
+close ($texpipe);
+
+my $error = $? >> 8;
+
+if ($error) {
+ if ( ($SHOWVALUE || $showvalue) && ($errormsg =~ /^You can't use `.*' after \\the\./) ) {
+ print STDERR "\n$name:\nError: Given command sequence does not contain a value.\n\n";
+ }
+ else {
+ print STDERR "\n$name:\nCompile error: $errormsg\n\n";
+ }
+ next;
+}
+
+print "\n(in preamble)" if $inpreamble;
+print "\n$name:\n$definition\n\n";
+
+
+testdef($origcmd,$definition);
+
+}
+
+chdir $cwd;
+__END__
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index cd18ce36c11..65db602ba91 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -335,7 +335,7 @@ my @TLP_working = qw(
tensor termcal termlist teubner
tex-ewd tex-font-errors-cheatsheet tex-gyre tex-label tex-overview
texapi texcount
- texdiff texdirflatten texilikechaps texilikecover
+ texdef texdiff texdirflatten texilikechaps texilikecover
texloganalyser texlogos texmate texments
texpower texshade
textcase textfit textmerg textopo textpath textpos tfrupee
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 2d2e22a2a54..05edd2cff57 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -40,7 +40,10 @@ chdir "../tmp.cooked" || die "chdir(../tmp.cooked) failed: $!";
$COOKED_TOP = getcwd(); # output (cooked) directory paren
chdir $RAW_DIR || die "chdir($RAW_DIR) failed: $!"; # back to raw
-$Master = "$mydir/../..";
+# the real Master and Build tree.
+chomp ($Master = `cd $mydir/../.. && pwd`);
+chomp ($Build = `cd $Master/../Build/source && pwd`);
+
#
# packages to treat entirely on their own, or not at all.
@@ -1888,6 +1891,7 @@ $standardxmt='\.xmt';
'sty2dtx' => '\.pl$',
'svn-multi' => 'svn-multi\.pl$',
'texcount' => '\.pl$',
+ 'texdef' => '\.pl$',
'texdiff' => 'texdiff$',
'texdirflatten' => 'texdirflatten$',
'texloganalyser' => 'texloganalyser',
@@ -2015,7 +2019,7 @@ for (@ARGV) {
$package = pop (@x);
my $COOKED_PKG = "$COOKED_TOP/$package"; # output directory
- if ($package eq "biber") { # later anything with scripts
+ if ($package =~ /^(biber|texdef)$/) { # later anything with scripts
$BUILDDEST = "$COOKED_PKG/Build/source";
$TOPDEST = "$COOKED_PKG/Master";
} else {
@@ -2328,8 +2332,7 @@ sub donormal
&do_posthook ();
}
-sub runins
-{
+sub runins {
my ($thispatt) = @_;
print "\t RUNINS $thispatt\n";
for (grep (/$thispatt/, @filenames)) {
@@ -2340,8 +2343,7 @@ sub runins
&killfiles ($specialclean{$package} || $standardclean);
}
-sub install
-{
+sub install {
my ($destdir,$thispatt) = @_;
return unless $thispatt;
@@ -2479,35 +2481,78 @@ sub dotype1{
&install("$DEST/fonts/sfd/$package", $sfdpatt);
}
+
+
# scripts. Make them executable even if it isn't always necessary.
# Build/source/tex/texlive/linked_scripts/Makefile.am installs symlinks
# in the bin directories where needed. That Makefile is independently
-# maintained, needs to updated by hand when new user-visible scripts are
-# added.
+# maintained, needs to be updated by hand when new user-visible scripts
+# are added. We do add/update the script itself under linked_scripts.
+# We also make the symlinks/w32-wrapper-copy in Master/bin when new.
#
-sub doscripts
-{
- my $scriptpatt = $specialscripts{$package};
- return unless $scriptpatt;
- &install ("$DEST/scripts/$package", $scriptpatt);
- &SYSTEM ("chmod a+x $DEST/scripts/$package/*");
+sub doscripts {
+ my $scriptpatt = $specialscripts{$package};
+ return unless $scriptpatt;
+
+ &install ("$DEST/scripts/$package", $scriptpatt);
+ &SYSTEM ("chmod a+x $DEST/scripts/$package/*");
+
+ return unless $package eq "texdef"; # xx just testing this one for now
+ # update the copy in Build, too.
+ my $build_tldir = "texk/texlive";
+ my $build_scriptsdir = "$build_tldir/linked_scripts";
+ my $builddir = "$BUILDDEST/$build_scriptsdir/$package";
+ &xmkdir ($builddir);
+ &SYSTEM ("$CP $DEST/scripts/$package/* $builddir/");
+
+ # List of scripts we're installing.
+ chomp (my @scripts = `cd $builddir && ls`);
+
+ # For each, give a warning if missing from the Makefile.am in the sources.
+ # Also, if not already present, create the platform-specific bindir entries.
+ #
+ my $scripts_Makefile = "$Build/$build_scriptsdir/Makefile.am";
+ chomp (my @platforms = `cd $Master/bin && ls`);
+ #
+ for my $s (@scripts) {
+ system ("grep $package/$s $scripts_Makefile >&/dev/null");
+ if ($? != 0) {
+ print "*** $package/$s not in $scripts_Makefile\n";
+ }
+
+ (my $linkname = $s) =~ s/\..*$//;
+ next if -e "$Master/bin/i386-linux/$linkname"; # already there, move on
+ for my $p (@platforms) {
+ my $platdir = "$TOPDEST/bin/$p";
+ &xmkdir ($platdir);
+ if ($p ne "win32") {
+ my $linktarget = "../../$dest_tree/scripts/$package/$s";
+ &SYSTEM ("ln -s $linktarget $platdir/$linkname");
+ } else {
+ # Windows. If a shell script, skip. Else copy the wrapper.
+ next if $s =~ /\.sh$|^[^.]+$/;
+ my $w32_wrapper = "$Build/$build_tldir/w32_wrapper/runscript.exe";
+ &SYSTEM ("$CP $w32_wrapper $platdir/$linkname.exe");
+ }
+ }
+ }
}
+
+
# info files. We put these in texmf/doc/info, which is where we keep
# the info files for the programs, too. Having an info dir in
# texmf-dist also would imply lots of changes in the installer, and
# there seems to be no gain.
#
-sub doinfos
-{
+sub doinfos {
my $infopatt = $specialinfos{$package};
return unless $infopatt;
&install ("$TOPDEST/texmf/doc/info/", $infopatt);
}
# xmltex files
-sub doxmt
-{
+sub doxmt {
my $xmtpatt = $specialxmt{$package} || $standardxmt;
&install ("$DEST/tex/xmltex/$package", $xmtpatt);
}
@@ -4109,8 +4154,6 @@ sub POSTbiber {
my %tl_platform = (
"MSWIN" => "win32",
"cygwin32" => "i386-cygwin",
- "amd64-freebsd7" => "amd64-freebsd",
- "i386-freebsd7" => "i386-freebsd",
"darwin_x86_i386" => "universal-darwin",
"darwin_x86_64" => "x86_64-darwin",
"linux_x86_32" => "i386-linux",
@@ -4121,12 +4164,10 @@ sub POSTbiber {
# handle the prebuilt binaries, which are zipped or tarred.
for my $archive (sort (<biber-*>)) {
- next if $archive =~ /freebsd[68]$/; # we only want freebsd7
+ next if $archive =~ /freebsd[68]\./; # we only want freebsd7
- my ($unarchiver,$post) = &biber_unarchiver ($archive);
+ my $unarchiver = &biber_unarchiver ($archive);
&SYSTEM ("$unarchiver $archive");
- (my $archive_file = $archive) =~ s/\..z$//; # for x86-solaris.xz
- &SYSTEM ("$post $archive_file* biber") if $post;
# each .tar.gz unpacks into a single file named biber,
# .zip unpacks into biber.exe.
@@ -4158,25 +4199,19 @@ sub POSTbiber {
# biber binaries are distributed in a variety of ways. The idea here is
# to specify the commands that will get from the distribution on CTAN to
# a binary named "biber".
-sub biber_unarchiver {
+#
+sub unarchiver {
my ($archive) = @_;
- my ($unarch,$post) = ("", "");
+ my ($unarch) = ("", "");
if ($archive =~ /\.tar\./) {
$unarch = "tar xf";
- } elsif ($archive =~ /\.xz$/) {
- $unarch = "unxz";
- $post = "cp";
} elsif ($archive =~ /\.zip$/) {
$unarch = "unzip -q";
- } elsif ($archive =~ /freebsd.$/) {
- $unarch = "true";
- $post = "cp";
} else {
- print "hello $archive?\n";
die "do not know unarchiver for $archive";
}
- return ($unarch,$post);
+ return $unarch;
}
sub POSTbibtex {
diff --git a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc
index 106e5bfe214..2596f562869 100644
--- a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc
@@ -45,6 +45,7 @@ depend seetexk
depend sty2dtx
depend synctex
depend texcount
+depend texdef
depend texdiff
depend texdirflatten
depend texdoc
diff --git a/Master/tlpkg/tlpsrc/texdef.tlpsrc b/Master/tlpkg/tlpsrc/texdef.tlpsrc
new file mode 100644
index 00000000000..9e971494919
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/texdef.tlpsrc
@@ -0,0 +1 @@
+binpattern f bin/${ARCH}/texdef