summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/texlive/linked_scripts/ChangeLog4
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.am1
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.in1
-rw-r--r--Build/source/texk/texlive/linked_scripts/sty2dtx/sty2dtx.pl0
l---------Master/bin/alpha-linux/sty2dtx1
l---------Master/bin/amd64-freebsd/sty2dtx1
l---------Master/bin/amd64-kfreebsd/sty2dtx1
l---------Master/bin/i386-cygwin/sty2dtx1
l---------Master/bin/i386-freebsd/sty2dtx1
l---------Master/bin/i386-kfreebsd/sty2dtx1
l---------Master/bin/i386-linux/sty2dtx1
l---------Master/bin/i386-netbsd/sty2dtx1
l---------Master/bin/i386-solaris/sty2dtx1
l---------Master/bin/mips-irix/sty2dtx1
l---------Master/bin/powerpc-aix/sty2dtx1
l---------Master/bin/powerpc-linux/sty2dtx1
l---------Master/bin/sparc-linux/sty2dtx1
l---------Master/bin/sparc-solaris/sty2dtx1
l---------Master/bin/universal-darwin/sty2dtx1
-rwxr-xr-xMaster/bin/win32/sty2dtx.exebin0 -> 1536 bytes
l---------Master/bin/x86_64-darwin/sty2dtx1
l---------Master/bin/x86_64-linux/sty2dtx1
l---------Master/bin/x86_64-solaris/sty2dtx1
-rw-r--r--Master/texmf-dist/doc/support/sty2dtx/README32
-rwxr-xr-xMaster/texmf-dist/scripts/sty2dtx/sty2dtx.pl160
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds1
-rw-r--r--Master/tlpkg/tlpsrc/collection-binextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/sty2dtx.tlpsrc0
29 files changed, 219 insertions, 1 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/ChangeLog b/Build/source/texk/texlive/linked_scripts/ChangeLog
index d7bf9def09a..bab51c76216 100644
--- a/Build/source/texk/texlive/linked_scripts/ChangeLog
+++ b/Build/source/texk/texlive/linked_scripts/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-29 Karl Berry <karl@tug.org>
+
+ * Makefile.am (texmf_dist_perl_scripts): add sty2dtx.pl.
+
2010-12-29 Peter Breitenlohner <peb@mppmu.mpg.de>
* Makefile.am [WIN32]: Install wrapper binary for bin_links
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am
index e18bfa96635..014095485c8 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.am
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.am
@@ -92,6 +92,7 @@ texmf_dist_perl_scripts = \
pst2pdf/pst2pdf \
purifyeps/purifyeps \
splitindex/perl/splitindex.pl \
+ sty2dtx/sty2dtx.pl \
svn-multi/svn-multi.pl \
texcount/texcount.pl \
texdiff/texdiff \
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in
index 3f99dfbaa64..cda3af383d4 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.in
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.in
@@ -245,6 +245,7 @@ texmf_dist_perl_scripts = \
pst2pdf/pst2pdf \
purifyeps/purifyeps \
splitindex/perl/splitindex.pl \
+ sty2dtx/sty2dtx.pl \
svn-multi/svn-multi.pl \
texcount/texcount.pl \
texdiff/texdiff \
diff --git a/Build/source/texk/texlive/linked_scripts/sty2dtx/sty2dtx.pl b/Build/source/texk/texlive/linked_scripts/sty2dtx/sty2dtx.pl
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/texk/texlive/linked_scripts/sty2dtx/sty2dtx.pl
diff --git a/Master/bin/alpha-linux/sty2dtx b/Master/bin/alpha-linux/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/alpha-linux/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/amd64-freebsd/sty2dtx b/Master/bin/amd64-freebsd/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/amd64-freebsd/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/amd64-kfreebsd/sty2dtx b/Master/bin/amd64-kfreebsd/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/amd64-kfreebsd/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/i386-cygwin/sty2dtx b/Master/bin/i386-cygwin/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/i386-cygwin/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/i386-freebsd/sty2dtx b/Master/bin/i386-freebsd/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/i386-freebsd/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/i386-kfreebsd/sty2dtx b/Master/bin/i386-kfreebsd/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/i386-kfreebsd/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/i386-linux/sty2dtx b/Master/bin/i386-linux/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/i386-linux/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/i386-netbsd/sty2dtx b/Master/bin/i386-netbsd/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/i386-netbsd/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/i386-solaris/sty2dtx b/Master/bin/i386-solaris/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/i386-solaris/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/mips-irix/sty2dtx b/Master/bin/mips-irix/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/mips-irix/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/powerpc-aix/sty2dtx b/Master/bin/powerpc-aix/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/powerpc-aix/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/powerpc-linux/sty2dtx b/Master/bin/powerpc-linux/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/powerpc-linux/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/sparc-linux/sty2dtx b/Master/bin/sparc-linux/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/sparc-linux/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/sparc-solaris/sty2dtx b/Master/bin/sparc-solaris/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/sparc-solaris/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/universal-darwin/sty2dtx b/Master/bin/universal-darwin/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/universal-darwin/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/win32/sty2dtx.exe b/Master/bin/win32/sty2dtx.exe
new file mode 100755
index 00000000000..5777d90a17a
--- /dev/null
+++ b/Master/bin/win32/sty2dtx.exe
Binary files differ
diff --git a/Master/bin/x86_64-darwin/sty2dtx b/Master/bin/x86_64-darwin/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/x86_64-darwin/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/x86_64-linux/sty2dtx b/Master/bin/x86_64-linux/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/x86_64-linux/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/bin/x86_64-solaris/sty2dtx b/Master/bin/x86_64-solaris/sty2dtx
new file mode 120000
index 00000000000..4ae681e3e4d
--- /dev/null
+++ b/Master/bin/x86_64-solaris/sty2dtx
@@ -0,0 +1 @@
+../../texmf-dist/scripts/sty2dtx/sty2dtx.pl \ No newline at end of file
diff --git a/Master/texmf-dist/doc/support/sty2dtx/README b/Master/texmf-dist/doc/support/sty2dtx/README
new file mode 100644
index 00000000000..5ea1cc55a6c
--- /dev/null
+++ b/Master/texmf-dist/doc/support/sty2dtx/README
@@ -0,0 +1,32 @@
+Copyright (c) 2010-2011 Martin Scharrer <martin@scharrer-online.de>
+This is open source software under the GPL v3 or later.
+
+Converts a .sty file (LaTeX package) to .dtx format (documented LaTeX source),
+by surrounding macro definitions with 'macro' and 'macrocode' environments.
+The macro name is automatically inserted as an argument to the 'macro'
+environemnt.
+Code lines outside macro definitions are wrapped only in 'macrocode'
+environments. Empty lines are removed.
+The script is not thought to be fool proof and 100% accurate but rather
+as a good start to convert undocumented style file to .dtx files.
+It does not generate a complete .dtx file, just the code section.
+
+Usage:
+ perl sty2dtx.pl infile [infile ...] outfile
+or
+ perl sty2dtx.pl < file.sty > file.dtx
+
+
+The following macro definitions are detected when they are at the start of a
+line (can be prefixed by \global, \long, \protected and/or \outer):
+ \def \edef \gdef \xdef
+ \newcommand{\name} \newcommand*{\name}
+ \newcommand\name \newcommand*\name
+ \renewcommand{\name} \renewcommand*{\name}
+ \renewcommand\name \renewcommand*\name
+ \providecommand{\name} \providecommand*{\name}
+ \providecommand\name \providecommand*\name
+ \@namedef{\name} \@namedef\name
+
+The macro definition must either end at the same line or with a '}' on its own
+on a line.
diff --git a/Master/texmf-dist/scripts/sty2dtx/sty2dtx.pl b/Master/texmf-dist/scripts/sty2dtx/sty2dtx.pl
new file mode 100755
index 00000000000..1823a84e811
--- /dev/null
+++ b/Master/texmf-dist/scripts/sty2dtx/sty2dtx.pl
@@ -0,0 +1,160 @@
+#!/usr/bin/env perl
+################################################################################
+# Copyright (c) 2010-2011 Martin Scharrer <martin@scharrer-online.de>
+# This is open source software under the GPL v3 or later.
+#
+# Converts a .sty file (LaTeX package) to .dtx format (documented LaTeX source),
+# by surrounding macro definitions with 'macro' and 'macrocode' environments.
+# The macro name is automatically inserted as an argument to the 'macro'
+# environemnt.
+# Code lines outside macro definitions are wrapped only in 'macrocode'
+# environments. Empty lines are removed.
+# The script is not thought to be fool proof and 100% accurate but rather
+# as a good start to convert undocumented style file to .dtx files.
+#
+# Usage:
+# perl sty2dtx.pl infile [infile ...] outfile
+# or
+# perl sty2dtx.pl < file.sty > file.dtx
+#
+#
+# The following macro definitions are detected when they are at the start of a
+# line (can be prefixed by \global, \long, \protected and/or \outer):
+# \def \edef \gdef \xdef
+# \newcommand{\name} \newcommand*{\name}
+# \newcommand\name \newcommand*\name
+# \renewcommand{\name} \renewcommand*{\name}
+# \renewcommand\name \renewcommand*\name
+# \providecommand{\name} \providecommand*{\name}
+# \providecommand\name \providecommand*\name
+# \@namedef{\name} \@namedef\name
+#
+# The macro definition must either end at the same line or with a '}' on its own
+# on a line.
+#
+# $Id: sty2dtx.pl 2091 2011-01-28 01:25:44Z martin $
+################################################################################
+use strict;
+use warnings;
+
+# Used as format string of printf so that the '%' must be doubled:
+my $macrostart = <<'EOT';
+%% \begin{macro}{\%s}
+%% \begin{macrocode}
+EOT
+
+# Printed normally:
+my $macrostop = <<'EOT';
+% \end{macrocode}
+% \end{macro}
+%
+EOT
+
+my $macrocodestart = <<'EOT';
+% \begin{macrocode}
+EOT
+
+my $macrocodestop = <<'EOT';
+% \end{macrocode}
+%
+EOT
+
+my $mode = 0;
+
+# 0 = outside of macro or macrocode environments
+# 1 = inside macro environment
+# 2 = inside macrocode environment
+
+# RegExs for macro names and defintion:
+my $macroname = qr/[a-zA-Z\@:]+/; # Add ':' for LaTeX3 style macros
+my $definition = qr/
+ ^ # Begin of line (no whitespaces!)
+ (
+ (?:(?:\\global|\\long|\\protected|\\outer)\s*)* # Prefixes (maybe with whitespace between them)
+ )
+ \\(
+ [gex]?def \s* \\ # TeX definitions
+ | (?:new|renew|provide)command\s* \*? \s* {? \s* \\ # LaTeX definitions
+ | \@namedef{? # Definition by name only
+ )
+ ($macroname) # Macro name without backslash
+ (.*) # Rest of line
+ /xms;
+
+# Last (but not only) argument is output file, except if it is '-' (=STDOUT)
+if (@ARGV > 1) {
+ my $outfile = pop;
+ if ($outfile ne '-') {
+ open (OUTPUT, '>', $outfile) or die ("Could not open output file '$outfile'!");
+ select OUTPUT;
+ }
+}
+
+while (<>) {
+ # Test for macro definition command
+ if (/$definition/) {
+ my $pre = $1 || ""; # before command
+ my $cmd = $2; # definition command
+ my $name = $3; # macro name
+ my $rest = $4; # rest of line
+ if ( $cmd =~ /command\*?{/ ) {
+ $rest =~ s/^}//; # handle '\newcommand{\name}
+ }
+
+ # Print end of environment, if one is open
+ if ( $mode == 1 ) {
+ # Happens only if closing brace is not on a line by its own.
+ print $macrostop;
+ }
+ elsif ( $mode == 2 ) {
+ print $macrocodestop;
+ }
+
+ # Print 'macro' environment with current line.
+ printf $macrostart, $name;
+ print $_;
+
+ # Inside macro mode
+ $mode = 1;
+
+ # Test for one line definitions.
+ # $pre is tested to handle '{\somecatcodechange\gdef\name{short}}' lines
+ my $prenrest = $pre . $rest;
+ if ( $prenrest =~ tr/{/{/ == $prenrest =~ tr/}/}/ ) {
+ print $macrostop;
+ # Outside mode
+ $mode = 0;
+ }
+ }
+ # A single '}' on a line ends a 'macro' environment
+ elsif ($mode == 1 && /^}\s*$/) {
+ print $_, $macrostop;
+ $mode = 0;
+ }
+ # Remove empty lines (mostly between macros)
+ elsif (/^$/) {
+ }
+ else {
+ # If inside an environment
+ if ($mode) {
+ print;
+ }
+ else {
+ # Start macrocode environment
+ print $macrocodestart, $_;
+ $mode = 2;
+ }
+ }
+}
+
+# Print end of environment, if one is open
+if ( $mode == 1 ) {
+ # Happens only if closing brace is not on a line by its own.
+ print $macrostop;
+}
+elsif ( $mode == 2 ) {
+ print $macrocodestop;
+}
+
+__END__
+
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 8b2c41df87d..f5e6945bdfb 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -309,7 +309,7 @@ my @TLP_working = qw(
srcltx stack stage standalone starfont statistik statex statex2 staves
stdclsdv stdpage steinmetz
stellenbosch stex stix stringstrings struktex
- sttools stubs suanpan subdepth subeqn subeqnarray
+ sttools stubs sty2dtx suanpan subdepth subeqn subeqnarray
subfig subfigmat subfigure subfloat substr subsupscripts sudoku
sudokubundle suftesi sugconf
supertabular susy svg-inkscape svgcolor svn svn-multi svn-prov svninfo
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 598498c4fc8..469efaa639a 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -1831,6 +1831,7 @@ $standardxmt='\.xmt';
'pkfix-helper' => 'pkfix-helper$',
'pst2pdf' => 'pst2pdf$',
'purifyeps' => 'purifyeps$',
+ 'sty2dtx' => '\.pl$',
'svn-multi' => 'svn-multi\.pl$',
'texcount' => '\.pl$',
'texdiff' => 'texdiff$',
diff --git a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc
index 0633fedf99b..106e5bfe214 100644
--- a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc
@@ -42,6 +42,7 @@ depend pkfix
depend pkfix-helper
depend purifyeps
depend seetexk
+depend sty2dtx
depend synctex
depend texcount
depend texdiff
diff --git a/Master/tlpkg/tlpsrc/sty2dtx.tlpsrc b/Master/tlpkg/tlpsrc/sty2dtx.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/sty2dtx.tlpsrc