diff options
author | Karl Berry <karl@freefriends.org> | 2007-08-24 18:44:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-08-24 18:44:02 +0000 |
commit | 666fcd1c013c91ae11d762fe724612f53161becf (patch) | |
tree | 6ad926e796e02cc123a03330f9e52d65cb360bd0 /Master/texmf-dist/source/latex | |
parent | fe752bd7396fcc8c6fb65128bcd481a5e326e7cd (diff) |
/home/texlive/karl/Master/texmf-dist/doc/latex/makedtx
git-svn-id: svn://tug.org/texlive/trunk@4805 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/makedtx/makedtx.dtx | 425 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/makedtx/makedtx.ins | 30 |
2 files changed, 308 insertions, 147 deletions
diff --git a/Master/texmf-dist/source/latex/makedtx/makedtx.dtx b/Master/texmf-dist/source/latex/makedtx/makedtx.dtx index 3e6ec676341..eaefdfe11df 100644 --- a/Master/texmf-dist/source/latex/makedtx/makedtx.dtx +++ b/Master/texmf-dist/source/latex/makedtx/makedtx.dtx @@ -1,5 +1,5 @@ %\iffalse -% makedtx.dtx generated using makedtx version 0.93b (c) Nicola Talbot +% makedtx.dtx generated using makedtx version 0.94b (c) Nicola Talbot % Command line args: % -macrocode ".*\.p.*l" % -src "creatdtx.(.*)=>creatdtx.\1" @@ -8,11 +8,11 @@ % -v "1" % -dir "source" % -setambles ".*\.p.*l=>\nopreamble\nopostamble" -% -comment "ARRAY(0x91ff234)" +% -comment ".*\.p.*l" % -doc "manual.tex" % -codetitle "creatdtx.sty code" % makedtx -% Created on 2007/8/2 15:16 +% Created on 2007/8/19 14:16 %\fi %\iffalse %<*package> @@ -63,6 +63,7 @@ \newcommand{\ics}[1]{\cs{#1}\SpecialMainIndex{#1}} \CheckSum{8} +\newcommand{\PDFLaTeX}{PDF\LaTeX} \begin{document} @@ -70,11 +71,11 @@ \end{document} %</driver> %\fi -%\title{makedtx v0.93b : a Perl script to help create a DTX +%\title{makedtx v0.94b : a Perl script to help create a DTX %file from source code} %\author{Nicola Talbot\\ %\url{http://theoval.cmp.uea.ac.uk/~nlct/}} -%\date{2nd August 2007} +%\date{19th August 2007} %\maketitle % %\tableofcontents @@ -102,7 +103,7 @@ %HTML). % %Why should I want to convert my documentation to HTML when I can just -%use PDF\LaTeX? The more general purpose packages that I write (such +%use \PDFLaTeX? The more general purpose packages that I write (such %as \texttt{datetime} and \texttt{glossary}) I upload to CTAN, however %most of the packages I write are specific to the School of Computing %Sciences at the University of East Anglia, so these I keep on my web @@ -233,18 +234,45 @@ % %\item[\switch{preamble} \meta{text}] Set the preamble to %\texttt{text}. The default preamble is:\par -%\begin{ttfamily} -%Copyright (C) \meta{date} \meta{author}, all rights reserved. -%If you modify this file, you must change its name first. -%You are NOT ALLOWED to distribute this file alone. You are NOT -%ALLOWED to take money for the distribution or use of either this -%file or a changed version, except for a nominal charge for copying -%etc. +%\changes{0.94}{2007/08/19}{default preamble changed to one +%conforming with the LPPL}% +%\begin{ttfamily}\obeylines +% \meta{basename}.dtx +% Copyright \meta{date} \meta{author} +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license of (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is \meta{author}. +% +% This work consists of the files \meta{basename}.dtx and +% \meta{basename}.ins and the derived files \meta{file list}. %\end{ttfamily} % %where \meta{date} is the copyright date, and \meta{author} is the %author's name (see below). % +%\textbf{Note that this has been changed as of makedtx v0.94. +%Older versions of makedtx do not conform to any of the free +%licenses.} +% +%\item[\switch{license} \meta{name}] +%\changes{0.94}{2007/08/19}{license switch added}% +%This sets the preamble to +%the license text for the license \meta{name}. Currently \meta{name} +%may be either \texttt{lppl} (the default, which produces the +%default preamble detailed above), \texttt{bsd} or \texttt{gpl}. +%You may use either \switch{license} or \switch{preamble}, +%but not both. (If you have used the \switch{preamble} switch, the +%\switch{license} switch will be ignored.) +% %\item[\switch{postamble} \meta{text}] Set the postamble to %\texttt{text}. If this is omitted the \ics{postamble} command is %omitted from the installation script. @@ -296,9 +324,7 @@ %preamble but you do want the character table included use %\verb"\\usepreamble\\empty" instead of \verb'\\nopreamble'. %Conversely, if you want a preamble but don't want the character table -%do something like \verb"\\nopreamble\\usepreamble\\defaultpreamble", -%although I can't think of a good reason for wanting either of these -%situations.) +%do something like \verb"\\nopreamble\\usepreamble\\defaultpreamble". % %Note that the \verb"=>"\meta{text} part is optional. If it is %omitted, \meta{text} is assumed to be empty. @@ -490,16 +516,27 @@ %\end{verbatim} %The installation file \texttt{dashdate.ins} looks like: %\begin{verbatim} -% % dashdate.ins generated using makedtx.pl version 0.9b 2005/2/10 22:22 +% % dashdate.ins generated using makedtx.pl version 0.94b 2007/8/19 22:22 % \input docstrip % % \preamble -% Copyright (C) 2005 AN Other, all rights reserved. -% If you modify this file, you must change its name first. -% You are NOT ALLOWED to distribute this file alone. You are NOT -% ALLOWED to take money for the distribution or use of either this -% file or a changed version, except for a nominal charge for copying -% etc. +% dashdate.dtx +% Copyright 2007 AN Other +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license of (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is AN Other. +% +% This work consists of the files dashdate.dtx and +% dashdate.ins and the derived file dashdate.sty. % \endpreamble % % \askforoverwritefalse @@ -847,10 +884,10 @@ _IGNORED_CMDS_ #!/usr/bin/perl # File : makedtx -# Author : Dr Nicola Talbot +# Author : Nicola L. C. Talbot # Date : 29 Oct 2004 -# Last Modified : 2 Aug 2007 -# Version : 0.93b +# Last Modified : 19 Aug 2007 +# Version : 0.94b # usage : makedtx [options] -src <expr>=><expr> -doc <filename> <basename> # @@ -862,7 +899,7 @@ _IGNORED_CMDS_ use Getopt::Long; -$version = "0.93b"; +$version = "0.94b"; # process command line options @@ -873,7 +910,7 @@ $version = "0.93b"; "preamble=s", "postamble=s", "setambles=s@", "macrocode=s@", "author=s", "date=s", "stopeventually=s", "prefinale=s", "codetitle=s", "comment=s@", -"version") or &syntaxerror(); +"version", "license=s") or &syntaxerror(); $srcdir = "."; $patternop = "="; @@ -886,6 +923,7 @@ $author = (getpwuid($<))[6] || 'Unknown'; $stopeventually = ""; $prefinale = ""; $codetitle = "The Code"; +$license = "lppl"; ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); @@ -969,38 +1007,32 @@ foreach $setting (keys %optctl) { @comment = @{ $optctl{$setting} }; } + elsif ($setting eq "license") + { + $license = $optctl{$setting}; + } } -if ($preamble eq "") +if ($#ARGV != 0) { - $preamble = "Copyright (C) $year $author, all rights reserved.\n"; - $preamble = $preamble . "If you modify this file, you must change its name first.\n"; - $preamble = $preamble . "You are NOT ALLOWED to distribute this file alone. You are NOT\n"; - $preamble = $preamble . "ALLOWED to take money for the distribution or use of either this\n"; - $preamble = $preamble . "file or a changed version, except for a nominal charge for copying\n"; - $preamble = $preamble . "etc."; + print "No basename specified\n"; + &syntaxerror(); } +$basename = $ARGV[0]; + if ($docsrc eq "") { print "No document source specified (missing -doc)\n"; &syntaxerror(); } -if ($#ARGV != 0) -{ - print "No basename specified\n"; - &syntaxerror(); -} - if ($#source == -1) { print "No source code specified (missing -src)\n"; &syntaxerror(); } -$basename = $ARGV[0]; - open DTX, ">$basename.dtx" or die "Can't open '$basename.dtx'\n"; if ($verbose) @@ -1008,6 +1040,148 @@ if ($verbose) print "Documentation source : " . $docsrc . "\n"; } +# work out the derived files + + @srcdirfile = glob("$srcdir/*"); + + @derivedfiles = (); + + @outputfiles = (); + +$numoutput = 0; + +foreach $source (@source) +{ + ($infile, $outfile, $remainder) = split /=>/, $source; + + if ($outfile eq "") + { + print "-src $source argument invalid (no output file specified)\n"; + + &syntaxerror(); + } + + if (not ($remainder eq "")) + { + print "-src $source argument invalid (too many => specified)\n"; + + &syntaxerror(); + } + + foreach $srcdirfile (@srcdirfile) + { + $fileexp = $srcdir . "/" . $infile; + + $_ = $srcdirfile; + + $expr = "s$patternop$fileexp$patternop$outfile$patternop"; + + if (eval($expr)) + { + $thisoutfile = $_; + + $thisinfile = $srcdirfile; + + $file{$thisinfile} = $thisoutfile; + $derivedfiles[$numoutput]{'in'} = $thisinfile; + $derivedfiles[$numoutput]{'out'} = $thisoutfile; + $outputfiles[$numoutput] = $thisoutfile; + + $numoutput++; + } + } +} + +if ($preamble eq "") +{ + if ($license eq "lppl") + { + $preamble = <<_END_LICENSE + + $basename.dtx + Copyright $year $author + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either version 1.3 + of this license of (at your option) any later version. + The latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of LaTeX + version 2005/12/01 or later. + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainer of this work is $author. + +_END_LICENSE + } + elsif ($license eq 'bsd') + { + $preamble = <<_END_LICENSE + + $basename.dtx + Copyright (c) $year $author + All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +_END_LICENSE + } + elsif ($license eq 'gpl') + { + $preamble = <<_END_LICENSE + + $basename.dtx + Copyright (c) $year $author + + 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 2 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +_END_LICENSE + } + else + { + die "Unknown license '$license'\n". + "Known licenses: lppl, bsd, gpl"; + } + + $preamble .= " This work consists of the files " + . "$basename.dtx and $basename.ins and the derived " + . ($numoutput > 1 ? "files" : "file") + . " " . join(', ', @outputfiles) . ".\n"; +} + open DOC, $docsrc or die "Can't open '$docsrc'\n"; print DTX "\%\\iffalse\n"; @@ -1037,6 +1211,13 @@ foreach $setting (keys %optctl) print DTX "\% -macrocode \"$macrocode\"\n"; } } + elsif ($setting eq "comment") + { + foreach $comment (@comment) + { + print DTX "\% -comment \"$comment\"\n"; + } + } else { $val = $optctl{$setting}; @@ -1257,104 +1438,69 @@ if ($stopfound==0) print DTX "\%\\section{$codetitle}\n"; -@srcdirfile = glob("$srcdir/*"); - - %file = (); - -foreach $source (@source) +for (my $idx = 0; $idx <= $#derivedfiles; $idx++) { - ($infile, $outfile, $remainder) = split /=>/, $source; - - if ($outfile eq "") - { - print "-src $source argument invalid (no output file specified)\n"; - - &syntaxerror(); - } + $thisinfile = $derivedfiles[$idx]{'in'}; + $thisoutfile = $derivedfiles[$idx]{'out'}; - if (not ($remainder eq "")) + if ($verbose) { - print "-src $source argument invalid (too many => specified)\n"; - - &syntaxerror(); + print "$srcdirfile -> $_ \n"; } - foreach $srcdirfile (@srcdirfile) - { - $fileexp = $srcdir . "/" . $infile; + open SRC, $thisinfile or die "Can't open $thisinfile\n"; - $_ = $srcdirfile; + print DTX "\%\\iffalse\n"; + print DTX "\% \\begin{macrocode}\n"; + print DTX "\%<*$thisoutfile>\n"; + print DTX "\% \\end{macrocode}\n"; + print DTX "\%\\fi\n"; - $expr = "s$patternop$fileexp$patternop$outfile$patternop"; + $macrocode = 0; + $comment = 0; - if (eval($expr)) + foreach $expr (@comment) + { + if ($thisoutfile =~ m/$expr/) { - if ($verbose) - { - print "$srcdirfile -> $_ \n"; - } - - $thisoutfile = $_; - - $thisinfile = $srcdirfile; - - open SRC, $thisinfile or die "Can't open $thisinfile\n"; - print DTX "\%\\iffalse\n"; - print DTX "\% \\begin{macrocode}\n"; - print DTX "\%<*$thisoutfile>\n"; - print DTX "\% \\end{macrocode}\n"; - print DTX "\%\\fi\n"; - - $macrocode = 0; - $comment = 0; - - foreach $expr (@comment) - { - if ($thisoutfile =~ m/$expr/) - { - print DTX "\%\\iffalse\n"; - - $comment = 1; - } - } - foreach $expr (@macrocode) - { - if ($thisoutfile =~ m/$expr/) - { - print DTX "\% \\begin{macrocode}\n"; + $comment = 1; + } + } - $macrocode = 1; - } - } + foreach $expr (@macrocode) + { + if ($thisoutfile =~ m/$expr/) + { + print DTX "\% \\begin{macrocode}\n"; - while (<SRC>) - { - print DTX "$_"; - } + $macrocode = 1; + } + } - if ($macrocode == 1) - { - print DTX "\% \\end{macrocode}\n"; - } + while (<SRC>) + { + print DTX "$_"; + } - if ($comment == 1) - { - print DTX "\%\\fi\n"; - } + if ($macrocode == 1) + { + print DTX "\% \\end{macrocode}\n"; + } - print DTX "\%\\iffalse\n"; - print DTX "\% \\begin{macrocode}\n"; - print DTX "\%</$thisoutfile>\n"; - print DTX "\% \\end{macrocode}\n"; - print DTX "\%\\fi\n"; + if ($comment == 1) + { + print DTX "\%\\fi\n"; + } - close SRC; + print DTX "\%\\iffalse\n"; + print DTX "\% \\begin{macrocode}\n"; + print DTX "\%</$thisoutfile>\n"; + print DTX "\% \\end{macrocode}\n"; + print DTX "\%\\fi\n"; - $file{$thisinfile} = $thisoutfile; - } - } + close SRC; } print DTX "\%$prefinale\n" if ($prefinale); @@ -1392,9 +1538,10 @@ if (!$noins) print INS "\\generate{"; - foreach $file (keys %file) + for (my $idx = 0; $idx <= $#derivedfiles; $idx++) { - $outfile = $file{$file}; + $file = $derivedfiles[$idx]{'in'}; + $outfile = $derivedfiles[$idx]{'out'}; print INS "\\file{$outfile}{"; @@ -1484,23 +1631,25 @@ sub help print "Optional Arguments:\n\n"; - print "-dir <directory> : search for source files in <directory>\n"; - print "-op <character> : set the pattern matching operator (default '$patternop')\n"; - print "-askforoverwrite : set askforoverwrite switch in INS file to true\n"; + print "-dir <directory> : search for source files in <directory>\n"; + print "-op <character> : set the pattern matching operator (default '$patternop')\n"; + print "-askforoverwrite : set askforoverwrite switch in INS file to true\n"; print "-noaskforoverwrite : set askforoverwrite switch in INS file to false (default)\n"; print "-preamble <text> : set the preamble. Standard one inserted if omitted\n"; print "-postamble <text> : set the postamble.\n"; print "-setambles \"<pattern>=><text>\" : set pre- and postambles to <text> if file matches pattern\n"; - print "-author <text> : name of author (inserted into standard preamble. User name inserted if omitted)\n"; - print "-date <text> : copyright date\n"; - print "-ins : create the ins file (default)\n"; - print "-noins : don't create the ins file\n"; - print "-prefinale <text> : add <text> immediately prior to \\Finale\n"; - print "-macrocode <expr> : surround any file which matches <expr> in a macrocode environment\n"; - print "-comment <expr> : surround any file which matches <expr> with \\iffalse \\fi pair\n"; - print "-codetitle <text> : The title for the documented code section (default: The Code)\n"; - print "-h : help message\n"; - print "-v : verbose\n\n"; + print "-author <text> : name of author (inserted into standard preamble. User name inserted if omitted)\n"; + print "-date <text> : copyright date\n"; + print "-ins : create the ins file (default)\n"; + print "-noins : don't create the ins file\n"; + print "-prefinale <text> : add <text> immediately prior to \\Finale\n"; + print "-macrocode <expr> : surround any file which matches <expr> in a macrocode environment\n"; + print "-comment <expr> : surround any file which matches <expr> with \\iffalse \\fi pair\n"; + print "-codetitle <text> : The title for the documented code section (default: The Code)\n"; + print "-license <license> : use the given license for the preamble.\n"; + print " Known licenses: lppl (default), bsd, gpl.\n"; + print "-h : help message\n"; + print "-v : verbose\n\n"; print "Examples:\n\n"; diff --git a/Master/texmf-dist/source/latex/makedtx/makedtx.ins b/Master/texmf-dist/source/latex/makedtx/makedtx.ins index 60632620fc5..0f28af11859 100644 --- a/Master/texmf-dist/source/latex/makedtx/makedtx.ins +++ b/Master/texmf-dist/source/latex/makedtx/makedtx.ins @@ -1,20 +1,32 @@ -% makedtx.ins generated using makedtx version 0.93b 2007/8/2 15:16 +% makedtx.ins generated using makedtx version 0.94b 2007/8/19 14:16 \input docstrip \preamble -Copyright (C) 2007 Nicola Talbot, all rights reserved. -If you modify this file, you must change its name first. -You are NOT ALLOWED to distribute this file alone. You are NOT -ALLOWED to take money for the distribution or use of either this -file or a changed version, except for a nominal charge for copying -etc. + + makedtx.dtx + Copyright 2007 Nicola Talbot + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either version 1.3 + of this license of (at your option) any later version. + The latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of LaTeX + version 2005/12/01 or later. + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainer of this work is Nicola Talbot. + + This work consists of the files makedtx.dtx and makedtx.ins and the derived files creatdtx.perl, creatdtx.sty, makedtx.pl. + \endpreamble \askforoverwritefalse -\generate{\file{creatdtx.sty}{\usepreamble\defaultpreamble +\generate{\file{creatdtx.perl}{\nopreamble\nopostamble\from{makedtx.dtx}{creatdtx.perl}} +\file{creatdtx.sty}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{makedtx.dtx}{creatdtx.sty,package}} -\file{creatdtx.perl}{\nopreamble\nopostamble\from{makedtx.dtx}{creatdtx.perl}} \file{makedtx.pl}{\nopreamble\nopostamble\from{makedtx.dtx}{makedtx.pl}} } |