diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-06-30 12:02:38 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-06-30 12:02:38 +0000 |
commit | f8a3c29fe384820da1741b8a6e1089832b7089f0 (patch) | |
tree | dc2c0d343aa07c2a55a4da6fa43486192fdf2e83 /Master/texmf-dist | |
parent | 18b35455490b1234ec3fc8b4efd54c674990fc70 (diff) |
listings-ext update {v67}{10/06/29}
git-svn-id: svn://tug.org/texlive/trunk@19195 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/listings-ext/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/listings-ext/THIS_IS_VERSION_v58 | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/listings-ext/THIS_IS_VERSION_v67 | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/listings-ext/hyperref.cfg | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/listings-ext/listings-ext.el | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/listings-ext/listings-ext.mk | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/listings-ext/listings-ext.pdf | bin | 121968 -> 126280 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/listings-ext/listings-ext_exmpl_d.java | 2 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/listings-ext/listings-ext.sh | 95 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/listings-ext/listings-ext.dtx | 233 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/listings-ext/listings-ext.sty | 2 |
11 files changed, 175 insertions, 177 deletions
diff --git a/Master/texmf-dist/doc/latex/listings-ext/README b/Master/texmf-dist/doc/latex/listings-ext/README index 86ff83fa8c2..189846ba559 100644 --- a/Master/texmf-dist/doc/latex/listings-ext/README +++ b/Master/texmf-dist/doc/latex/listings-ext/README @@ -1,5 +1,5 @@ # -# $Revision: 43 $ +# $Revision: 60 $ # The LaTeX package "listings-ext.dtx" contains some macros and a supporting Bash script, which can be used to automatically input parts of source code diff --git a/Master/texmf-dist/doc/latex/listings-ext/THIS_IS_VERSION_v58 b/Master/texmf-dist/doc/latex/listings-ext/THIS_IS_VERSION_v58 deleted file mode 100644 index 755048d5838..00000000000 --- a/Master/texmf-dist/doc/latex/listings-ext/THIS_IS_VERSION_v58 +++ /dev/null @@ -1 +0,0 @@ -VERSION v58 of 2010/05/18 diff --git a/Master/texmf-dist/doc/latex/listings-ext/THIS_IS_VERSION_v67 b/Master/texmf-dist/doc/latex/listings-ext/THIS_IS_VERSION_v67 new file mode 100644 index 00000000000..3965943e82b --- /dev/null +++ b/Master/texmf-dist/doc/latex/listings-ext/THIS_IS_VERSION_v67 @@ -0,0 +1 @@ +VERSION v67 of 2010/06/29 diff --git a/Master/texmf-dist/doc/latex/listings-ext/hyperref.cfg b/Master/texmf-dist/doc/latex/listings-ext/hyperref.cfg index 6804552128d..3fe70257acf 100644 --- a/Master/texmf-dist/doc/latex/listings-ext/hyperref.cfg +++ b/Master/texmf-dist/doc/latex/listings-ext/hyperref.cfg @@ -19,6 +19,6 @@ integration of parts of source files into a documentation} pdfauthor={Jobst Hoffmann, Fachhochschule Aachen J\"ulich Campus, - <j.hoffmann@fh-aachen.de>}, + <j.hoffmann_(at)_fh-aachen.de>}, pdfkeywords={PDF, TeX, LaTeX, listings}, } diff --git a/Master/texmf-dist/doc/latex/listings-ext/listings-ext.el b/Master/texmf-dist/doc/latex/listings-ext/listings-ext.el index b5bf6c5b167..41f0bdad396 100644 --- a/Master/texmf-dist/doc/latex/listings-ext/listings-ext.el +++ b/Master/texmf-dist/doc/latex/listings-ext/listings-ext.el @@ -2,10 +2,10 @@ ;; Copyright (C) 2008-2010 Free Software Foundation, Inc. -;; Maintainer: Jobst Hoffmann, <j.hoffmann@fh-aachen.de> +;; Maintainer: Jobst Hoffmann, <j.hoffmann_(at)_fh-aachen.de> ;; $Author: ax006ho $ -;; $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $ -;; $Revision: 58 $ +;; $Date: 2010-06-29 18:38:12 +0200 (Di, 29 Jun 2010) $ +;; $Revision: 67 $ ;; Keywords: tex ;;; Commentary: diff --git a/Master/texmf-dist/doc/latex/listings-ext/listings-ext.mk b/Master/texmf-dist/doc/latex/listings-ext/listings-ext.mk index 3db72b0ce29..e1056ebd9ac 100644 --- a/Master/texmf-dist/doc/latex/listings-ext/listings-ext.mk +++ b/Master/texmf-dist/doc/latex/listings-ext/listings-ext.mk @@ -30,8 +30,8 @@ # - tar-dist: create a gzipped .tar-file containing # version information # -# Author: Jobst Hoffmann, Fachhochschule Aachen, Standort Juelich -# $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $ +# Author: Jobst Hoffmann, Fachhochschule Aachen, Campus Juelich +# $Date: 2010-06-29 18:38:12 +0200 (Di, 29 Jun 2010) $ #----------------------------------------------------------------------- # The texmf-directory, where to install new stuff (see texmf.cnf) @@ -118,13 +118,13 @@ DISTRIBUTION_FILES = $(PACKAGE).pdf $(PACKAGE).dtx \ ## Main Targets -all: $(PACKAGE).dvi - # strip off the comments from the package $(PACKAGE).sty $(PACKAGE)-test-*.tex: $(PACKAGE).ins $(PACKAGE).dtx +$(LATEX) $<; \ sh $(PACKAGE).makemake +all: $(PACKAGE).dvi + # generate the documentation $(PACKAGE).dvi: $(PACKAGE).dtx $(PACKAGE).sty +rm -f *.ind *.gls diff --git a/Master/texmf-dist/doc/latex/listings-ext/listings-ext.pdf b/Master/texmf-dist/doc/latex/listings-ext/listings-ext.pdf Binary files differindex a5891b2cb5f..fcd79a717a1 100644 --- a/Master/texmf-dist/doc/latex/listings-ext/listings-ext.pdf +++ b/Master/texmf-dist/doc/latex/listings-ext/listings-ext.pdf diff --git a/Master/texmf-dist/doc/latex/listings-ext/listings-ext_exmpl_d.java b/Master/texmf-dist/doc/latex/listings-ext/listings-ext_exmpl_d.java index 2a34dea627a..8f9495a510d 100644 --- a/Master/texmf-dist/doc/latex/listings-ext/listings-ext_exmpl_d.java +++ b/Master/texmf-dist/doc/latex/listings-ext/listings-ext_exmpl_d.java @@ -12,7 +12,7 @@ import java.util.ResourceBundle; * <br> * Created: : 2007/04/12 11:24:48$ * - * @author <a href="mailto:N.N@fh-aachen.de">N.N.</a> + * @author <a href="mailto:N.N_(at)_fh-aachen.de">N.N.</a> * @version : 0.0$ */ // ee: introductory comment diff --git a/Master/texmf-dist/scripts/listings-ext/listings-ext.sh b/Master/texmf-dist/scripts/listings-ext/listings-ext.sh index 1ae88ac0568..5e47ec064bf 100755 --- a/Master/texmf-dist/scripts/listings-ext/listings-ext.sh +++ b/Master/texmf-dist/scripts/listings-ext/listings-ext.sh @@ -1,10 +1,10 @@ #! /bin/sh ### listings-ext.sh --- -## Author: Dr. Jobst Hoffmann <j.hoffmann@fh-aachen.de> -## Version: $Id: listings-ext.dtx 58 2010-05-18 14:23:40Z ax006ho $ +## Author: Dr. Jobst Hoffmann <j.hoffmann_(at)_fh-aachen.de> +## Version: $Id: listings-ext.dtx 67 2010-06-29 16:38:12Z ax006ho $ ## Keywords: LaTeX, listings -## Copyright: (C) 2008-2010 Jobst Hoffmann, <j.hoffmann@fh-aachen.de> +## Copyright: (C) 2008-2010 Jobst Hoffmann, <j.hoffmann_(at)_fh-aachen.de> ##------------------------------------------------------------------- ## ## This file may be distributed and/or modified under the @@ -46,32 +46,29 @@ DEBUG_MODE=0 EXTENSION=0 HEADER=1 -show_usage() # display help massage -{ +show_usage() { # display help massage printf "${USAGE}" exit ${ERR_HELP} } -print_header() -{ +print_header() { FILE=$1 - echo "%% -- file $1 generated on $(date) by ${ME}" + printf "%%%% -- file $1 generated on $(date) by ${ME}\n" FILE=$(echo $(basename $1 .lst) | sed -e s/[_\-]//g) - echo "\\csname ${FILE}LstLoaded\\endcsname" - echo "\\expandafter\\let\\csname ${FILE}LstLoaded\\endcsname\\endinput" + printf "\\\\csname ${FILE}LstLoaded\\\\endcsname\n" + printf "\\\\expandafter\\\\let\\\\csname ${FILE}LstLoaded\\\\endcsname\\\\endinput\n" } -do_the_job() -{ +do_the_job() { PATHCOMPONENT=$(pwd) SOURCEFILE=$1 if [ ! -f ${SOURCEFILE} ] then - echo ${SOURCEFILE} is no valid file + printf "${SOURCEFILE} is no valid file\n" return $ERR_NOFILE fi SOURCEFILE=${SOURCEFILE##${PATHCOMPONENT}/} - grep -n "^ *[/%;#!][/\* ;]\ *[cbe]e:" $1 | \ + grep -n "^[[:space:]]*[/%;#!][/\* ;][[:space:]]*[cbe]e:" $1 | \ awk -v pathcomponent="${PATHCOMPONENT}" -v file="${SOURCEFILE}" \ -v header="${HEADER}" -v command="${COMMAND}" -v application="${ME}" \ -v debugmode="${DEBUG_MODE}" -v respect_extension="${EXTENSION}"\ @@ -94,27 +91,23 @@ BEGIN { if ( debugmode ) printf("path: %s\n", pathcomponent) > "/dev/stderr" if ( debugmode ) printf("file: %s\n", file) > "/dev/stderr" - n = split(pathcomponent, parts, "/"); + n = split(pathcomponent, partsa, "/"); curr_dir = parts[n] n++; - parts[n] = file; - inputfile = "/" parts[2]; + partsa[n] = file; + inputfile = "/" partsa[2]; for ( i = 3; i <= n; i++ ) { - if ( length(inputfile) + length(parts[i]) < linelen - 1) { - inputfile = inputfile "/" parts[i]; - } else { - inputfile = inputfile "%\n /" parts[i]; - } + inputfile = inputfile "/" partsa[i]; } - n = split(file, parts, "/") - n = split(parts[n], parts, ".") - identifier = parts[1] - for ( i = 2; i < n; i++ ) - { - identifier = identifier parts[i] + if ( debugmode ) printf("inputfile: %s\n", inputfile) > "/dev/stderr" + n = split(file, partsa, "/") + n = split(partsa[n], partsb, ".") + identifier = partsb[1] + for ( i = 2; i < n; i++ ) { + identifier = identifier partsb[i] } if ( respect_extension ) { - identifier = identifier parts[n] + identifier = identifier partsb[n] } identifier = replace_characters(identifier) if ( debugmode ) printf("identifier: %s\n", identifier) > "/dev/stderr" @@ -129,10 +122,9 @@ BEGIN { } else if ( match(text[1], "combine") ) { combine = 1; } - for ( i = 2; i <= n; i++ ) { - } } else if ( match($2, /be/) > 0 ) { opening_tag = $(NF) + gsub(/\r/, "", opening_tag); is_opened = 1 start = $1 + 1; # entry $1 is the line number } else if ( match($2, /ee/) > 0 ) { @@ -147,12 +139,14 @@ BEGIN { " not closed") } else { opening_tag = $(NF) + gsub(/\r/, "", opening_tag); is_opened = 1 start = $1 + 1; # entry $1 is the line number } } else { if ( match($2, /ee/) > 0 ) { closing_tag = $(NF) + gsub(/\r/, "", closing_tag); if ( !is_opened ) { print_error($1, "missing \"be\" declaration") } else if ( opening_tag == closing_tag ) { @@ -165,7 +159,7 @@ BEGIN { # setup the prefixes len = linelen - addchars - length(caption); - begin_prefix = "%"; + begin_prefix = "%%"; cnt = 0; while ( cnt < len) { begin_prefix = begin_prefix "="; @@ -173,7 +167,7 @@ BEGIN { }; begin_prefix = begin_prefix ">"; end_prefix = begin_prefix; - sub(/%/, "%==", end_prefix); + sub(/%%/, "%%==", end_prefix); if ( join ) { linerange = linerange ", " start "-" $1-1; } else if ( combine ) { @@ -224,7 +218,7 @@ END { for ( range in combine_array ) { if ( debugmode ) printf("range: %s, combine_array[range]: >%s<\n", \ range, combine_array[range]) > "/dev/stderr" - printf "%%-->> %s <<--\n", range + printf("%%%%-->> %s <<--\n", range) if ( command ) { print_command((identifier toB26(idPt++)), \ combine_array[range]); @@ -235,8 +229,7 @@ END { } } } -function replace_characters(identifier) -{ +function replace_characters(identifier) { tmp = "" toUppercase = 0 n = split(identifier, sequence, "") # split the string into an array @@ -257,16 +250,14 @@ function replace_characters(identifier) } return tmp } -function print_command(identifier, linerange) -{ +function print_command(identifier, linerange) { if ( debugmode ) printf("print_command.linerange: >%s<\n", linerange) > "/dev/stderr" print break_line("\\lstdef{" identifier "}{" inputfile "}{" \ linerange "}", linelen) } -function print_linerange(identifier, caption, linerange) -{ - print begin_prefix "begin{" \ - identifier"}\n{%\n \\def\\inputfile{%\n " inputfile "\n }"; +function print_linerange(identifier, caption, linerange) { + print break_line(begin_prefix "begin{" \ + identifier"}\n{%\n \\def\\inputfile{%\n " inputfile "%\n }"); local_style = ""; if ( header ) { @@ -277,7 +268,7 @@ function print_linerange(identifier, caption, linerange) local_style="style=localStyle, " } print " \\lstinputlisting[" local_style "linerange={" linerange "}]" \ - "%\n {%\n \\inputfile\n }\n" \ + "{%\n \\inputfile\n }\n" \ "}%\n" end_prefix "end{"identifier"}"; } function print_error(linenumber, error_message) @@ -285,8 +276,7 @@ function print_error(linenumber, error_message) printf "%--> error (line number %d): %s\n", \ linenumber, error_message > "/dev/stderr" } -function break_line(input_line, line_len) -{ +function break_line(input_line, line_len) { n = split(input_line, parts, "/"); output_line = parts[1]; len_curr = length(output_line) @@ -294,24 +284,21 @@ function break_line(input_line, line_len) len_next = length(parts[i]) if ( len_curr + len_next + 1 < linelen ) { output_line = output_line "/" parts[i]; - len_curr += len_next + 1 + len_curr += len_next + 1 # continue current line } else { output_line = output_line "%\n /" parts[i]; - len_curr = len_next + 7 + len_curr = len_next + 7 # start a new line } } return output_line } -function toB26(n10) -{ +function toB26(n10) { v26 = "" - do { remainder = n10%26 v26 = idArray[remainder+1] v26 n10 = int(n10/26) } while ( n10 != 0 ) - return v26 } ' @@ -354,7 +341,7 @@ if [ -n "${OUTFILE}" ] then if [ -f "${OUTFILE}" ] then - echo "%--> file \"${OUTFILE}\" already exists, creating backup" + printf "%s\n" "%--> file \"${OUTFILE}\" already exists, creating backup" mv ${OUTFILE} ${OUTFILE}~ fi exec > ${OUTFILE} # redirect stdout to ${OUTFILE} @@ -364,8 +351,8 @@ fi # now take all remaining arguments (should be all filenames) and do the job for arg do - echo "%-->" processing file \"$arg\" 1>&2 # echo the current - # filename to stderr + printf "%s\n" "%%--> processing file \"$arg\"" 1>&2 # echo the current + # filename to stderr do_the_job $arg done diff --git a/Master/texmf-dist/source/latex/listings-ext/listings-ext.dtx b/Master/texmf-dist/source/latex/listings-ext/listings-ext.dtx index 822141a7f14..1baeaa9b6a7 100644 --- a/Master/texmf-dist/source/latex/listings-ext/listings-ext.dtx +++ b/Master/texmf-dist/source/latex/listings-ext/listings-ext.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2008-2010 Jobst Hoffmann, FH Aachen, Standort J\"ulich <j.hoffmann@fh-aachen.de> +% Copyright (C) 2008-2010 Jobst Hoffmann, FH Aachen, Campus J\"ulich <j.hoffmann_(at)_fh-aachen.de> % ----------------------------------------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -16,6 +16,8 @@ % \fi % % +% \changes{v67}{10/06/29}{removed some needless blanks} +% \changes{v67}{10/06/29}{email adresses are obfuscated now} % \changes{v58}{10/05/18}{moved the docstrip guards into the corresponding macrocode environments} % \changes{v56}{10/03/09}{some small layout changes} % \changes{v37}{09/08/27}{changed the copyright message again} @@ -26,12 +28,12 @@ %<extension>{% %<extension> \def\@svn@ $#1Date: #2-#3-#4 #5$$#6Revision: #7$ {% %<extension> \ProvidesPackage{listings-ext}[#2/#3/#4 v#7 an extension for the listings package (JHf)]} -%<extension> \@svn@ $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $$Revision: 58 $ % +%<extension> \@svn@ $Date: 2010-06-29 18:38:12 +0200 (Di, 29 Jun 2010) $$Revision: 67 $ % %<extension>} % \fi -% \CheckSum{342} +% \CheckSum{363} % \changes{v41}{09/08/27}{removed typos again} -% \def\docdate {09/08/27} ^^A not style'able!! +% \def\docdate {10/06/29} ^^A not style'able!! % % \changes{v11}{09/04/15}{turned german documentation into an english one} %\iffalse @@ -56,7 +58,7 @@ % Ginsterweg 1 % 52428 J"ulich % Bundesrepublik Deutschland -% Email: <j.hoffmann@fh-aachen.de> +% Email: <j.hoffmann_(at)_fh-aachen.de> % %\fi % @@ -164,18 +166,19 @@ % \setcounter{secnumdepth}{2}% % \setcounter{tocdepth}{2}% % -% \title{\listingsext\ --- A collection of \LaTeX{} commands and some helper -% files to support the automatic integration of parts of source files -% into a documentation\thanks{% -% This file has the version number \fileversion, was last revised -% on \filedate, the documentation dates from \docdate.} }% -% \author{Jobst Hoffmann\\ -% Fachhochschule Aachen, Standort J\"ulich\\ +% \title{\listingsext\ --- A collection of \LaTeX{} commands and some +% helper files to support the automatic integration of parts of source +% files into a documentation\thanks{% +% This file has version number \fileversion, last revised on \filedate{}, +% documentation dated \docdate.}% +% }% +% \author{Jobst Hoffmann\\ +% Fachhochschule Aachen, Campus J\"ulich\\ % Ginsterweg 1\\ % 52428 J\"ulich\\ % Bundesrepublik Deutschland\\ -% email: j.hoffmann@fh-aachen.de}% -% \date{printed on \today} +% email: j.hoffmann\_(at)\_fh-aachen.de}% +% \date{printed on \today} % % ^^A\markboth{\LaTeX\ Stil-Option listings-ext, version \fileversion\ of \filedate} % ^^A {\LaTeX\ Stil-Option listings-ext, version \fileversion\ of \filedate} @@ -212,14 +215,14 @@ % \end{quote} % In \cite{lingnau07:_latex_hacks} there are described three macros, which % can be created automatically, so that in the case of changes in the -% source code the developer mustn't change the contents of the lineranges, +% source code the developer mustn't change the contents of the line ranges, % but she/he only has to rerun a program, which regenerates the meaning of % the macros. In the following the three macros and a Bash-script to deal with % these three macros are provided. % % % \changes{v16}{09/08/18}{added macros to make the documentation -% independent of non standard packages} +% independent of non standard packages} % \section[Installation and Maintenance]{Hints For Installation And Maintenance} % \label{sec:installation-maintenance} % @@ -239,7 +242,7 @@ % \begin{quote} %\begin{verbatim} %latex listings-ext.ins -%\end{verbatim}% +%\end{verbatim}% % \end{quote} % This formatting run generates several other files. These are first of % all the previous mentioned \ext{.sty}-file \Fname{listings-ext.sty}, the @@ -357,7 +360,7 @@ % \meta{identifier}, the last definition is valid. If you don't like % that behaviour, put the corresponding |\lstdef|- and % |\lstuse|-commands (see below) into a group of its own. -% \item \begin{quote} +% \item \begin{quote} % |\lstuse[|\meta{options}|]{|\meta{identifier}|}| % \end{quote} % includes the source code which is referenced by \meta{identifier} by @@ -388,13 +391,13 @@ % It' better to automate that procedure, and one way of implementig that is % done at the Bash-script \Fname{listings-ext.sh}. For working with that % script you have to tag the parts of the source, which you want to -% document, by comments. +% document, by comments. % % At the moment there are three tags, which can be described by the % following regular expressions: % \begin{enumerate} % \item |^\ +|\meta{endline-comment-character(s)}|\ be:\ |\meta{string}|$| -% +% % This expression defines the beginning of the environment, which should be % |\lstinput| into the document. % \item |^\ +|\meta{endline-comment-character(s)}|\ ee:\ |\meta{string}|$| @@ -416,18 +419,26 @@ % standard C comments |/*| \ldots|*/|, but in that case the trailing "|*/|" % is seen as the end of the \meta{string}.} % +% \changes{v63}{10/06/22}{added remarks about Max OS X} % \changes{v53}{10/03/09}{issue solved: now able to handle any file name as % list of source files} % If you have prepared a source code file with these tags, you can process -% it by the Bash-script provided by the package. The simplest way to do it -% is the call +% it by the Bash-script provided by the package. The script should work for +% a Linux system out of the box, for a Mac OS X 10.x one must additionally +% install |getopt| from \url{http://getopt.darwinports.com/}, which in turn +% needs |MacPorts| (from +% \url{http://www.macports.org/install.php}).\footnote{The package is +% tested with Max OS X v\,10.6.3, |getopt|'s version number is v\,1.1.4 and +% |MacPorts| version number is v\,1.9.0.} +% +% The simplest way to do it is the call % \begin{quote} -% |listings-ext.sh -c -o |\meta{file list} +% |listings-ext.sh -co |\meta{file list} % \end{quote} % \meta{file list} is a list of one or more file names. This call creates % the file \meta{directory}|.lst|, where \meta{directory} is the name of % the current directory. The file consists of a header and a list of |\lstdef| -% commands, +% commands, % of the form % \begin{quote} % |\lstdef{|\meta{identifier}|}{|\meta{filename}|}{|\meta{line range(s)}|}| @@ -569,7 +580,7 @@ \ProcessOptionsX* % \end{macrocode} % \end{macro} -% +% % Then we define the three above mentioned commands in the way, which is % described in \cite{lingnau07:_latex_hacks}. % \begin{macro}{\lstdef} @@ -729,17 +740,17 @@ % \changes{v06}{08/09/07}{created list of things to do} % To get full benefit of the three above introduced commands, we provide a % Bash-script, which internally uses |awk|, |grep| and |sed|. A Perl -% programmer could provide the same functionality by a Perl script. +% programmer could provide the same functionality by a Perl script. % % \begin{macrocode} %<*scriptfile> #! /bin/sh ### listings-ext.sh --- -## Author: Dr. Jobst Hoffmann <j.hoffmann@fh-aachen.de> -## Version: $Id: listings-ext.dtx 58 2010-05-18 14:23:40Z ax006ho $ +## Author: Dr. Jobst Hoffmann <j.hoffmann_(at)_fh-aachen.de> +## Version: $Id: listings-ext.dtx 67 2010-06-29 16:38:12Z ax006ho $ ## Keywords: LaTeX, listings -## Copyright: (C) 2008-2010 Jobst Hoffmann, <j.hoffmann@fh-aachen.de> +## Copyright: (C) 2008-2010 Jobst Hoffmann, <j.hoffmann_(at)_fh-aachen.de> ##------------------------------------------------------------------- ## ## This file may be distributed and/or modified under the @@ -751,7 +762,7 @@ ## ## and version 1.2 or later is part of all distributions of LaTeX ## version 1999/12/01 or later. -## +## ## This file belongs to the listings-ext package. ## ## listings-ext.sh creates code to be inserted into a @@ -813,7 +824,7 @@ % following regular expressions: % \begin{itemize} % \item |^\ +|\meta{endline-comment-character(s)}|\ be: |\meta{string}|$| -% +% % This expression defines the beginning of a environment, which should be % |\lstinput| into the document. % \item |^\ +|\meta{endline-comment-character(s)}|\ ee: |\meta{string}|$| @@ -832,7 +843,7 @@ % \item |join| % \item |combine| % \end{itemize} -% +% % At the moment we support only these keywords. The meaning of the % keywords is % \begin{itemize} @@ -869,8 +880,7 @@ DEBUG_MODE=0 EXTENSION=0 HEADER=1 -show_usage() # display help massage -{ +show_usage() { # display help massage printf "${USAGE}" exit ${ERR_HELP} } @@ -885,16 +895,16 @@ show_usage() # display help massage % \item \$2: directory - the last name in the directory path (currently % not used) % \end{itemize} +% \changes{v63}{10/06/22}{replaced most of the echo commands by printf (because of Mac OS X)} % \changes{v53}{10/03/09}{issue solved: now able to handle any file name as % list of source files} % \begin{macrocode} -print_header() -{ +print_header() { FILE=$1 - echo "%% -- file $1 generated on $(date) by ${ME}" + printf "%%%% -- file $1 generated on $(date) by ${ME}\n" FILE=$(echo $(basename $1 .lst) | sed -e s/[_\-]//g) - echo "\\csname ${FILE}LstLoaded\\endcsname" - echo "\\expandafter\\let\\csname ${FILE}LstLoaded\\endcsname\\endinput" + printf "\\\\csname ${FILE}LstLoaded\\\\endcsname\n" + printf "\\\\expandafter\\\\let\\\\csname ${FILE}LstLoaded\\\\endcsname\\\\endinput\n" } % \end{macrocode} ^^A $ % The main function is |do_the_job|. It accepts the following parameter: @@ -902,8 +912,7 @@ print_header() % \item \$1: a filename % \end{enumerate} % \begin{macrocode} -do_the_job() -{ +do_the_job() { % \end{macrocode} ^^A $ % In |awk| \$0 refers to the whole input record---to the current input % line---, so that element could be split into its components which are @@ -922,7 +931,7 @@ do_the_job() if [ ! -f ${SOURCEFILE} ] then - echo ${SOURCEFILE} is no valid file + printf "${SOURCEFILE} is no valid file\n" return $ERR_NOFILE fi % \end{macrocode} ^^A $ @@ -933,11 +942,12 @@ do_the_job() SOURCEFILE=${SOURCEFILE##${PATHCOMPONENT}/} % \end{macrocode} ^^A $ +% \changes{v65}{10/06/28}{grep: replaced blank by space regex} % \changes{v51}{10/03/33}{corrected the grep expression according to the definition of the syntax} % From the current source file, we grep all the lines with the above % mentioned pattern, prepend them by a line number (parameter |-n|) % \begin{macrocode} - grep -n "^ *[/%;#!][/\* ;]\ *[cbe]e:" $1 | \ + grep -n "^[[:space:]]*[/%;#!][/\* ;][[:space:]]*[cbe]e:" $1 | \ % \end{macrocode} ^^A $ % We pass all the lines to |awk|. Additionally we set some parameters and define % the field separator by |-F| as "|:|", so that from |awk|'s point of view @@ -977,40 +987,39 @@ BEGIN { if ( debugmode ) printf("path: %s\n", pathcomponent) > "/dev/stderr" if ( debugmode ) printf("file: %s\n", file) > "/dev/stderr" % \end{macrocode} -% for |\lstinputting| the file, we need the absolute filepath. In the +% For |\lstinputting| the file, we need the absolute filepath. In the % following, we construct this, the correspondent variable is |inputfile|, % the filename to be formatted is split into convenient pieces by a % macro +% \changes{v63}{10/06/22}{rewrote code for splitting paths into names} % \begin{macrocode} - n = split(pathcomponent, parts, "/"); + n = split(pathcomponent, partsa, "/"); curr_dir = parts[n] % \end{macrocode} +% \changes{v65}{10/06/28}{breaking of lines moved into a single place} % Add the file to the array to process the whole name in a similar manner. % \begin{macrocode} n++; - parts[n] = file; - inputfile = "/" parts[2]; + partsa[n] = file; + inputfile = "/" partsa[2]; for ( i = 3; i <= n; i++ ) { - if ( length(inputfile) + length(parts[i]) < linelen - 1) { - inputfile = inputfile "/" parts[i]; - } else { - inputfile = inputfile "%\n /" parts[i]; - } + inputfile = inputfile "/" partsa[i]; } + if ( debugmode ) printf("inputfile: %s\n", inputfile) > "/dev/stderr" % \end{macrocode} % For the identification of the several chunks we need the filename % without path and without suffix. We take everything behind the last % dot as suffix % +% \changes{v65}{10/06/28}{moved single \{ from beginning of line to end of previous line} % The |identifier| mustn't contain any path parts of the filename. So we % split the filename here. % \begin{macrocode} - n = split(file, parts, "/") - n = split(parts[n], parts, ".") - identifier = parts[1] - for ( i = 2; i < n; i++ ) - { - identifier = identifier parts[i] + n = split(file, partsa, "/") + n = split(partsa[n], partsb, ".") + identifier = partsb[1] + for ( i = 2; i < n; i++ ) { + identifier = identifier partsb[i] } % \end{macrocode} % If there are files with the same basename, but different extensions, we @@ -1018,7 +1027,7 @@ BEGIN { % \changes{v56}{10/03/09}{added processing of option "-e"} % \begin{macrocode} if ( respect_extension ) { - identifier = identifier parts[n] + identifier = identifier partsb[n] } identifier = replace_characters(identifier) if ( debugmode ) printf("identifier: %s\n", identifier) > "/dev/stderr" @@ -1036,6 +1045,7 @@ BEGIN { if ( debugmode ) print $0 > "/dev/stderr" if ( !initialised ) { % \end{macrocode} ^^A $ +% \changes{v67}{10/06/29}{added remark about CR and LF} % \changes{v09}{09/04/05}{extend the external documentation} % In the beginning, there are two cases to distinguish: % \begin{enumerate} @@ -1043,8 +1053,12 @@ BEGIN { % \item There is no introducing |ce| marker % \end{enumerate} % In the first case we have to set a flag according to the value of the -% mark, in the second case, we have to look for the first mark (|be| or -% |ce|). +% mark, in the second case we have to look for the first mark (|be| or +% |ce|). The marker is supposed to end at the line's end. If a \LaTeX{} +% source file is created with an editor, which creates the CRLF combination +% as the end of line, the CR would be thought as part of the marker. To +% avoid the trouble, the CR is removed (if it exists). +% \changes{v65}{10/06/28}{added code to remove spurious carriage return character} % \begin{macrocode} if ( match($2, /ce/) > 0 ) { n = split($(NF), text, ","); @@ -1053,10 +1067,9 @@ BEGIN { } else if ( match(text[1], "combine") ) { combine = 1; } - for ( i = 2; i <= n; i++ ) { - } } else if ( match($2, /be/) > 0 ) { opening_tag = $(NF) + gsub(/\r/, "", opening_tag); is_opened = 1 start = $1 + 1; # entry $1 is the line number } else if ( match($2, /ee/) > 0 ) { @@ -1071,17 +1084,20 @@ BEGIN { " not closed") } else { opening_tag = $(NF) + gsub(/\r/, "", opening_tag); is_opened = 1 start = $1 + 1; # entry $1 is the line number } } else { if ( match($2, /ee/) > 0 ) { closing_tag = $(NF) + gsub(/\r/, "", closing_tag); if ( !is_opened ) { print_error($1, "missing \"be\" declaration") } else if ( opening_tag == closing_tag ) { is_opened = 0 % \end{macrocode} ^^A $ +% \changes{v65}{10/06/28}{changed the prefix to a double \% to unify the output} % We found the correct end of the environment, now we prepare the output entries % \begin{macrocode} split($(NF), text, "*"); # omit a trailing comment @@ -1092,7 +1108,7 @@ BEGIN { # setup the prefixes len = linelen - addchars - length(caption); - begin_prefix = "%"; + begin_prefix = "%%"; cnt = 0; while ( cnt < len) { begin_prefix = begin_prefix "="; @@ -1100,7 +1116,7 @@ BEGIN { }; begin_prefix = begin_prefix ">"; end_prefix = begin_prefix; - sub(/%/, "%==", end_prefix); + sub(/%%/, "%%==", end_prefix); % \end{macrocode} ^^A $ % \changes{v09}{09/04/05}{rewrote the check of the flags} % Now we distinguish between |join|- and |combine|-mode and the default mode: @@ -1181,7 +1197,7 @@ END { % \begin{macrocode} if ( debugmode ) printf("range: %s, combine_array[range]: >%s<\n", \ range, combine_array[range]) > "/dev/stderr" - printf "%%-->> %s <<--\n", range + printf("%%%%-->> %s <<--\n", range) if ( command ) { print_command((identifier toB26(idPt++)), \ combine_array[range]); @@ -1204,8 +1220,7 @@ END { % \item |identifier|---the identifier with underscore characters % \end{enumerate} % \begin{macrocode} -function replace_characters(identifier) -{ +function replace_characters(identifier) { tmp = "" toUppercase = 0 n = split(identifier, sequence, "") # split the string into an array @@ -1236,30 +1251,29 @@ function replace_characters(identifier) % combine mode) % \end{enumerate} % \begin{macrocode} -function print_command(identifier, linerange) -{ +function print_command(identifier, linerange) { if ( debugmode ) printf("print_command.linerange: >%s<\n", linerange) > "/dev/stderr" print break_line("\\lstdef{" identifier "}{" inputfile "}{" \ linerange "}", linelen) } % \end{macrocode} % +% \changes{v65}{10/06/28}{added print\_break function call to print\_linerange} % |print_linerange| does something similar: instead of defining an identifier it % prints out a bunch of lines, which can be pasted into the % \LaTeX-source. Its arguments are % \begin{enumerate} % \item |identifier|---the identifier, an environment which has to be -% defined in advance -% \item |caption|---title or caption, taken either from surrounding environment or -% from the file name (in join mode) -% \item |linerange|---a linerange or a list of line ranges (in join or -% combine mode) +% defined in advance +% \item |caption|---title or caption, taken either from surrounding +% environment or from the file name (in join mode) +% \item |linerange|---a linerange or a list of line ranges (in join or +% combine mode) % \end{enumerate} % \begin{macrocode} -function print_linerange(identifier, caption, linerange) -{ - print begin_prefix "begin{" \ - identifier"}\n{%\n \\def\\inputfile{%\n " inputfile "\n }"; +function print_linerange(identifier, caption, linerange) { + print break_line(begin_prefix "begin{" \ + identifier"}\n{%\n \\def\\inputfile{%\n " inputfile "%\n }"); local_style = ""; if ( header ) { @@ -1270,7 +1284,7 @@ function print_linerange(identifier, caption, linerange) local_style="style=localStyle, " } print " \\lstinputlisting[" local_style "linerange={" linerange "}]" \ - "%\n {%\n \\inputfile\n }\n" \ + "{%\n \\inputfile\n }\n" \ "}%\n" end_prefix "end{"identifier"}"; } % \end{macrocode} @@ -1291,12 +1305,12 @@ function print_error(linenumber, error_message) % |break_line| breaks a (long) line into parts, which each have a length less % than a given line length. Its arguments are: % \begin{enumerate} -% \item |input_line|---the line to bwe broken -% \item |line_len|---the target length +% \item |input_line|---the line to bwe broken +% \item |line_len|---the target length % \end{enumerate} +% |input_line| may contain line breaks, so the results may look odd. % \begin{macrocode} -function break_line(input_line, line_len) -{ +function break_line(input_line, line_len) { n = split(input_line, parts, "/"); output_line = parts[1]; len_curr = length(output_line) @@ -1304,10 +1318,10 @@ function break_line(input_line, line_len) len_next = length(parts[i]) if ( len_curr + len_next + 1 < linelen ) { output_line = output_line "/" parts[i]; - len_curr += len_next + 1 + len_curr += len_next + 1 # continue current line } else { output_line = output_line "%\n /" parts[i]; - len_curr = len_next + 7 + len_curr = len_next + 7 # start a new line } } return output_line @@ -1323,16 +1337,13 @@ function break_line(input_line, line_len) % \item |n10|---the number to convert (base 10) % \end{enumerate} % \begin{macrocode} -function toB26(n10) -{ +function toB26(n10) { v26 = "" - do { remainder = n10%26 v26 = idArray[remainder+1] v26 n10 = int(n10/26) } while ( n10 != 0 ) - return v26 } ' @@ -1385,7 +1396,7 @@ if [ -n "${OUTFILE}" ] then if [ -f "${OUTFILE}" ] then - echo "%--> file \"${OUTFILE}\" already exists, creating backup" + printf "%s\n" "%--> file \"${OUTFILE}\" already exists, creating backup" mv ${OUTFILE} ${OUTFILE}~ fi exec > ${OUTFILE} # redirect stdout to ${OUTFILE} @@ -1395,8 +1406,8 @@ fi # now take all remaining arguments (should be all filenames) and do the job for arg do - echo "%-->" processing file \"$arg\" 1>&2 # echo the current - # filename to stderr + printf "%s\n" "%%--> processing file \"$arg\"" 1>&2 # echo the current + # filename to stderr do_the_job $arg done @@ -1570,7 +1581,7 @@ import java.util.ResourceBundle; * <br> * Created: : 2007/04/12 11:24:48$ * - * @author <a href="mailto:N.N@fh-aachen.de">N.N.</a> + * @author <a href="mailto:N.N_(at)_fh-aachen.de">N.N.</a> * @version : 0.0$ */ // ee: introductory comment @@ -1658,7 +1669,7 @@ public class HelloWorld % /listings-ext% % /listings-ext_exmpl_d.java}{9-12} % \end{verbatim} -% +% % So a small \LaTeX-file to test this case is % % \begin{macrocode} @@ -1700,26 +1711,26 @@ public class HelloWorld ;; Copyright (C) 2008-2010 Free Software Foundation, Inc. -;; Maintainer: Jobst Hoffmann, <j.hoffmann@fh-aachen.de> -;; $Author: ax006ho $ -;; $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $ -;; $Revision: 58 $ +;; Maintainer: Jobst Hoffmann, <j.hoffmann_(at)_fh-aachen.de> +;; $Author: ax006ho $ +;; $Date: 2010-06-29 18:38:12 +0200 (Di, 29 Jun 2010) $ +;; $Revision: 67 $ ;; Keywords: tex ;;; Commentary: ;; This file adds support for `listings-ext.sty' ;;; Code: -(TeX-add-style-hook +(TeX-add-style-hook "listings-ext" (lambda () (TeX-add-symbols '("lstcheck" "identifier" TeX-arg-input-file 0) '("lstdef" "identifier" TeX-arg-input-file "line range" 0) '("lstuse" ["options"] "identifier"0)) - + ;; Filling - + ;; Fontification (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) @@ -1790,24 +1801,24 @@ public class HelloWorld # - develop-pdf: history and source code (the latter provides # a .pdf file as output) # - history: generate the documentation with revision -# - history-pdf: history (the latter provides a .pdf file as +# - history-pdf: history (the latter provides a .pdf file as # output) # - examples: format the examples # - install: install the package in a standard TDS tree # - uninstall: uninstall the package from a standard TDS # tree # - clean: clean the directory of intermediate files -# - clean-examples: example and test files +# - clean-examples: example and test files # - clean-support: support files # - realclean: all but the pure source # files -# - tar-src: create a gzipped .tar-file of the pure +# - tar-src: create a gzipped .tar-file of the pure # source files -# - tar-dist: create a gzipped .tar-file containing +# - tar-dist: create a gzipped .tar-file containing # version information # -# Author: Jobst Hoffmann, Fachhochschule Aachen, Standort Juelich -# $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $ +# Author: Jobst Hoffmann, Fachhochschule Aachen, Campus Juelich +# $Date: 2010-06-29 18:38:12 +0200 (Di, 29 Jun 2010) $ #----------------------------------------------------------------------- # The texmf-directory, where to install new stuff (see texmf.cnf) @@ -1894,13 +1905,13 @@ DISTRIBUTION_FILES = $(PACKAGE).pdf $(PACKAGE).dtx \ ## Main Targets -all: $(PACKAGE).dvi - # strip off the comments from the package $(PACKAGE).sty $(PACKAGE)-test-*.tex: $(PACKAGE).ins $(PACKAGE).dtx +$(LATEX) $<; \ sh $(PACKAGE).makemake +all: $(PACKAGE).dvi + # generate the documentation $(PACKAGE).dvi: $(PACKAGE).dtx $(PACKAGE).sty +rm -f *.ind *.gls @@ -2106,7 +2117,7 @@ sed -e "`echo \"s/^ /@/g\" | tr '@' '\011'`" listings-ext.mk > Makefile && \ integration of parts of source files into a documentation} pdfauthor={Jobst Hoffmann, Fachhochschule Aachen J\"ulich Campus, - <j.hoffmann@fh-aachen.de>}, + <j.hoffmann_(at)_fh-aachen.de>}, pdfkeywords={PDF, TeX, LaTeX, listings}, } %</hyperref> diff --git a/Master/texmf-dist/tex/latex/listings-ext/listings-ext.sty b/Master/texmf-dist/tex/latex/listings-ext/listings-ext.sty index 3fba00f7b2d..b0071f73f0b 100644 --- a/Master/texmf-dist/tex/latex/listings-ext/listings-ext.sty +++ b/Master/texmf-dist/tex/latex/listings-ext/listings-ext.sty @@ -26,7 +26,7 @@ {% \def\@svn@ $#1Date: #2-#3-#4 #5$$#6Revision: #7$ {% \ProvidesPackage{listings-ext}[#2/#3/#4 v#7 an extension for the listings package (JHf)]} - \@svn@ $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $$Revision: 58 $ % + \@svn@ $Date: 2010-06-29 18:38:12 +0200 (Di, 29 Jun 2010) $$Revision: 67 $ % } \RequirePackage{listings} \RequirePackage{xkeyval} |