From eb07d6a8223898ec3dc5a8eecf34a474d5d848a9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 19 May 2010 00:22:04 +0000 Subject: listings-ext v58 (18may10) git-svn-id: svn://tug.org/texlive/trunk@18344 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/listings-ext/listings-ext.dtx | 449 +++++++++++---------- .../source/latex/listings-ext/listings-ext.ins | 9 +- 2 files changed, 242 insertions(+), 216 deletions(-) (limited to 'Master/texmf-dist/source/latex/listings-ext') 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 8edb5062474..822141a7f14 100644 --- a/Master/texmf-dist/source/latex/listings-ext/listings-ext.dtx +++ b/Master/texmf-dist/source/latex/listings-ext/listings-ext.dtx @@ -1,8 +1,6 @@ % \iffalse meta-comment % -% \changes{v37}{09/08/27}{changed the copyright message again} -% \changes{v11}{09/04/15}{changed the Copyright message} -% Copyright (C) 2008-2009 Jobst Hoffmann, FH Aachen, Standort J\"ulich +% Copyright (C) 2008-2010 Jobst Hoffmann, FH Aachen, Standort J\"ulich % ----------------------------------------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -18,24 +16,28 @@ % \fi % % +% \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} +% \changes{v11}{09/04/15}{changed the Copyright message} % \changes{v16}{09/08/18}{replaced macroname rcs by svn} % \iffalse %\NeedsTeXFormat{LaTeX2e}[1995/12/01] %{% % \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: 2009-08-31 20:30:48 +0200 (Mo, 31 Aug 2009) $$Revision: 48 $ % +% \@svn@ $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $$Revision: 58 $ % %} % \fi -% \CheckSum{341} +% \CheckSum{342} % \changes{v41}{09/08/27}{removed typos again} % \def\docdate {09/08/27} ^^A not style'able!! % % \changes{v11}{09/04/15}{turned german documentation into an english one} -%\iffalse +%\iffalse % % Package `listings-ext' for use with LaTeX v2e -% Copyright (C) 2008-2009 Jobst Hoffmann, +% Copyright (C) 2008-2010 Jobst Hoffmann , all rights reserved. % ----------------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -104,6 +106,8 @@ % % ^^A \setlength{\IndexMin}{0.3\textheight} % +% \changes{v56}{10/03/09}{corrected typo at `Fname} +% \changes{v50}{10/02/15}{changed some documentation commands to starred version} % \changes{v37}{09/08/27}{reworked the documentation} % \changes{v35}{09/08/27}{some textual changes}% % \changes{v34}{09/08/24}{reworked the documentation}% @@ -116,18 +120,19 @@ % \changes{v16}{09/08/18}{added macros to make the documentation % independent of non standard packages}% % \changes{v11}{09/04/15}{corrected some text}% -% \newcommand\Lopt[1]{\textsf{#1}}% +% ^^A now some macros to simplify the writing of the documentation +% \newcommand*\Lopt[1]{\textsf{#1}}% % \let\Lpack\Lopt% % \let\ext\Lopt% -% \newcommand\Fname[1]{\texttt{#1}}% -% \newcommand{\XEmacs}{\textsf{(X)Emacs}}% -% \newcommand{\SOURCEFRAME}{% +% \newcommand*{\Fname}[1]{\texttt{#1}}% +% \newcommand*{\XEmacs}{\textsf{(X)Emacs}}% +% \newcommand*{\SOURCEFRAME}{% % \psline(0,0)(0,7) % \psline(1.5,0)(1.5,7) % \rput[lc](0.75,0){\ldots} % \rput[lc](0.75,7){\ldots} % } -% \newcommand{\SOURCEA}[1]{% +% \newcommand*{\SOURCEA}[1]{% % \psline*[linecolor=LemonChiffon](0,0)(1.5,0)(1.5,2)(0,2)% % \if#1f% % \psline(0,0)(1.5,0)(1.5,2.0)(0,2.0)(0,0)% @@ -136,7 +141,7 @@ % \psline[linewidth=1mm, linecolor=DarkOliveGreen](0,-0.05)(1.5,-0.05)% % \fi\fi% % } -% \newcommand{\SOURCEB}[1]{% +% \newcommand*{\SOURCEB}[1]{% % \psline*[linecolor=LightGreen](0,0)(1.5,0)(1.5,0.5)(0,0.5)% % \if#1f% % \psline(0,0)(1.5,0)(1.5,0.5)(0,0.5)(0,0)% @@ -145,7 +150,7 @@ % \psline[linewidth=1mm, linecolor=DarkOliveGreen](0,-0.05)(1.5,-0.05)% % \fi\fi% % } -% \newcommand{\SOURCEC}[1]{% +% \newcommand*{\SOURCEC}[1]{% % \psline*[linecolor=LightCyan](0,0)(1.5,0)(1.5,1.25)(0,1.25)% % \if#1f% % \psline(0,0)(1.5,0)(1.5,1.25)(0,1.25)(0,0)% @@ -158,11 +163,12 @@ % \hbadness=10000 \vbadness=10000% % \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 version number \fileversion, was last revised on -% \filedate, the documentation dates from \docdate.} }% +% 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\\ % Ginsterweg 1\\ @@ -184,9 +190,11 @@ % % \newif\ifmulticols % \IfFileExists{multicol.sty}{\multicolstrue}{} +% % \ifmulticols % \addtocontents{toc}{\protect\begin{multicols}{2}} % \fi +% % \tableofcontents % % \section{Preface} @@ -286,10 +294,8 @@ % documentation} % This documentation itself is generated by the following internal driver % code: -% \iffalse -%<*driver> -% \fi % \begin{macrocode} +%<*driver> \documentclass[a4paper, ngerman, english]{ltxdoc} \usepackage[T1]{fontenc} @@ -306,7 +312,6 @@ \usepackage[numbered]{hypdoc} \usepackage{url} - %\EnableCrossrefs %\DisableCrossrefs % say \DisableCrossrefs if index is ready %\RecordChanges % gather update information @@ -318,10 +323,8 @@ \DocInput{listings-ext.dtx}% \end{document} -% \end{macrocode} -% \iffalse % -% \fi +% \end{macrocode} % % \changes{v13}{09/05/28}{enhanced the documentation} % \section{The User's Interface} @@ -413,6 +416,8 @@ % standard C comments |/*| \ldots|*/|, but in that case the trailing "|*/|" % is seen as the end of the \meta{string}.} % +% \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 @@ -433,7 +438,7 @@ % %% -- file listings-ext.lst generated on Mi 26. Aug 22:05:20 CEST 2009 % by listings-ext.sh % \csname listingsextLstLoaded\endcsname -% \let\listingsextLstLoaded\endinput +% \expandafter\let\csname listingsextLstLoaded\endcsname\endinput %\end{verbatim} % The first line is wrapped by hand, the second and third line prohibit a % second load of that file. One of the |\lstdef| could look like @@ -550,11 +555,9 @@ % \subsection{The style file} % \label{sec:the-style-file} % -% \iffalse -%<*extension> -% \fi % At first we must declare the required packages : % \begin{macrocode} +%<*extension> \RequirePackage{listings} \RequirePackage{xkeyval} % \end{macrocode} @@ -648,14 +651,11 @@ % \begin{macrocode} \@nameuse{lst@l@#2}{#1}% } +% % \end{macrocode} % \end{macro} % That' all for the \LaTeX-side of life. % -% \iffalse -% -% \fi -% % % \changes{v46}{09/08/31}{enhanced the documentation at several points} % \changes{v45}{09/08/31}{introduced an exemplary configuration file} @@ -666,10 +666,8 @@ % way. The easiest way to do that is to provide a style. The following % lines provide two styles, one for the use with a black and white % printer, the other for a printer which is capable of color output. -% \iffalse -%<*listings> -% \fi % \begin{macrocode} +%<*listings> \ProvidesFile{listings.cfg}% [2009/08/23 v1.0 listings configuration of listings-ext] @@ -699,16 +697,15 @@ commentstyle=\small\fontfamily{lmtt}\fontseries{m}\fontshape{sl}\selectfont, stringstyle=\small\fontfamily{lmtt}\fontseries{m}\fontshape{it}\selectfont, } -% \end{macrocode} -% \iffalse % -% \fi +% \end{macrocode} % % % \changes{v16}{09/08/18}{moved the documentation of the script into the documentation} % \subsection{The shell script} % \label{sec:the-shell-script} % +% \changes{v58}{10/05/18}{removed some bashisms (according to Ahmed El-Mahmoudy---aelmahmoudy\_at\_sabily.org)} % \changes{v37}{09/08/27}{removed small glitches} % \changes{v23}{09/08/20}{moved some more comment from the script into the documentation} % \changes{v12}{09/05/12}{added some debug code} @@ -734,17 +731,15 @@ % Bash-script, which internally uses |awk|, |grep| and |sed|. A Perl % programmer could provide the same functionality by a Perl script. % -% \iffalse -%<*scriptfile> -% \fi % \begin{macrocode} +%<*scriptfile> #! /bin/sh ### listings-ext.sh --- ## Author: Dr. Jobst Hoffmann -## Version: $Id: listings-ext.dtx 48 2009-08-31 18:30:48Z ax006ho $ +## Version: $Id: listings-ext.dtx 58 2010-05-18 14:23:40Z ax006ho $ ## Keywords: LaTeX, listings -## Copyright: (C) 2008-2009 Jobst Hoffmann, +## Copyright: (C) 2008-2010 Jobst Hoffmann, ##------------------------------------------------------------------- ## ## This file may be distributed and/or modified under the @@ -849,34 +844,34 @@ % These lines will be grepped. The result is processed by |awk| where '|:|' is % defined as a field separator, the final result is a range of lines, which % is further processed to create the output. +% \changes{v56}{10/03/09}{a new usage description, added new option "-e"} % \changes{v33}{09/08/23}{corrected description of usage of the script} % \begin{macrocode} ERR_HELP=1 ME=$(basename $0) -USAGE="usage:\n\t${ME} [-c|--command] [-h|--help] [-g|--debug] \\\\\n \ -\t\t[-n|--no-header] \\\\\n \ -\t\t[{-o|--output-file} []] , ...\n \ -\t-c:\tgenerate commands, which can be input and later used by\n \ -\t\t\\\\lstuse, optional\n \ -\t-g:\tdebug mode, create some additional output, optional\n \ -\t-h:\tshow this help, optional\n \ -\t-n:\twrite no header into the LaTeX code, optional; valid only,\n \ -\t\tif -c isn't used\n \ -\t-o []: if this argument is present, the output will\n \ -\t\tbe written into a file ; if the\n \ -\t\t is omitted, the output is redirected\n \ -\t\tinto a file with a basename, which corresponds to the name\n \ -\t\tof the current directory, it has an extension of \".lst\".\n\n \ -remark:\n\tIf contains characters others than lower \ -and upper\n\tcase characters, \"-\" and \"_\", can't be\ - directly\n\tprocessed by TeX.\n \ +USAGE="usage:\n\t${ME} [-c|--command] [-e|--ext] [-g|--debug] \\\\\n\ +\t\t[-h|--help] [-n|--no-header] \\\\\n\ +\t\t[{-o|--output-file} []] , ...\n\ +\t-c:\tgenerate commands, which can be input and later used by\n\ +\t\t\\\\lstuse, optional\n\ +\t-e:\tinclude file name extension into the identifier\n\ +\t-g:\tdebug mode, create some additional output, optional\n\ +\t-h:\tshow this help, optional\n\ +\t-n:\twrite no header into the LaTeX code, optional; valid only,\n\ +\t\tif -c isn't used\n\ +\t-o []: if this argument is present, the output will\n\ +\t\tbe written into a file ; if the\n\ +\t\t is omitted, the output is redirected\n\ +\t\tinto a file with a basename corresponding to the name\n\ +\t\tof the current directory, it has an extension of \".lst\".\n\ " +DEBUG_MODE=0 +EXTENSION=0 HEADER=1 -DEBUGMODE=0 show_usage() # display help massage { - echo -e ${USAGE} + printf "${USAGE}" exit ${ERR_HELP} } % \end{macrocode} ^^A $ @@ -890,6 +885,8 @@ show_usage() # display help massage % \item \$2: directory - the last name in the directory path (currently % not used) % \end{itemize} +% \changes{v53}{10/03/09}{issue solved: now able to handle any file name as +% list of source files} % \begin{macrocode} print_header() { @@ -897,7 +894,7 @@ print_header() echo "%% -- file $1 generated on $(date) by ${ME}" FILE=$(echo $(basename $1 .lst) | sed -e s/[_\-]//g) echo "\\csname ${FILE}LstLoaded\\endcsname" - echo "\\let\\${FILE}LstLoaded\\endinput" + echo "\\expandafter\\let\\csname ${FILE}LstLoaded\\endcsname\\endinput" } % \end{macrocode} ^^A $ % The main function is |do_the_job|. It accepts the following parameter: @@ -936,10 +933,11 @@ do_the_job() SOURCEFILE=${SOURCEFILE##${PATHCOMPONENT}/} % \end{macrocode} ^^A $ +% \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 "^ *[/%;#!][/\* ;]\ *[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 @@ -949,14 +947,15 @@ do_the_job() % \item the opening/closing tag % \item an identifying string % \end{enumerate} +% \changes{v56}{10/03/09}{a cleaner handling of passing parameters to awk} % \begin{macrocode} - awk -v pathcomponent="$PATHCOMPONENT" -v file="$SOURCEFILE" \ - -v header="$HEADER" -v command="$COMMAND" -v application="${ME}" \ - -v debugmode="$DEBUG_MODE" \ + awk -v pathcomponent="${PATHCOMPONENT}" -v file="${SOURCEFILE}" \ + -v header="${HEADER}" -v command="${COMMAND}" -v application="${ME}" \ + -v debugmode="${DEBUG_MODE}" -v respect_extension="${EXTENSION}"\ -F : \ ' BEGIN { -% \end{macrocode} +% \end{macrocode} ^^A $ % \changes{v09}{09/04/05}{reflect the introduction of the command combine} % We start the code with some settings. % In |awk| the value 1 means "true", the value 0 "false". @@ -1013,6 +1012,14 @@ BEGIN { { identifier = identifier parts[i] } +% \end{macrocode} +% If there are files with the same basename, but different extensions, we +% may take account of the extensions. +% \changes{v56}{10/03/09}{added processing of option "-e"} +% \begin{macrocode} + if ( respect_extension ) { + identifier = identifier parts[n] + } identifier = replace_characters(identifier) if ( debugmode ) printf("identifier: %s\n", identifier) > "/dev/stderr" } @@ -1075,7 +1082,7 @@ BEGIN { } else if ( opening_tag == closing_tag ) { is_opened = 0 % \end{macrocode} ^^A $ -% we found the correct end of the environment, now prepare the output entries +% We found the correct end of the environment, now we prepare the output entries % \begin{macrocode} split($(NF), text, "*"); # omit a trailing comment sub(/ /, "", text[1]); # delete leading spaces @@ -1117,7 +1124,8 @@ BEGIN { combine_array[closing_tag] = \ combine_array[closing_tag] ", " start "-" $1-1 } - if ( debugmode ) printf("combine_array: >%s<\n", combine_array[closing_tag]) > "/dev/stderr" + if ( debugmode ) printf("combine_array: >%s<\n",\ + combine_array[closing_tag]) > "/dev/stderr" } else { % \end{macrocode} ^^A $ % We are neither in |combine|- nor in |join|-mode, so we can print out the @@ -1146,6 +1154,16 @@ BEGIN { } } END { +% \end{macrocode} ^^A $ +% There may be an erroneous open group, this is announced now. +% \changes{v56}{10/03/09}{added handling of missing "ee" declarations} +% \begin{macrocode} + if ( is_opened ) { + print_error($1, "missing \"ee\" declaration") + } +% \end{macrocode} ^^A $ +% And now for the post processing \ldots +% \begin{macrocode} caption = "\\lstinline|" file "|"; if ( join ) { sub(/, /, "", linerange); @@ -1174,7 +1192,7 @@ END { } } } -% \end{macrocode} +% \end{macrocode} ^^A $ % % \changes{v25}{09/08/21}{corrected some leading spaces before the beginning % percent sign of a line} @@ -1328,8 +1346,8 @@ fi % \end{macrocode} % Processing the options is done by means of getop, see |man getopt| % \begin{macrocode} -GETOPT=$(getopt -o cghno:: \ - --longoptions command,debug-mode,help,no-header,output-file:: \ +GETOPT=$(getopt -o ceghno:: \ + --longoptions command,debug-mode,ext,help,no-header,output-file:: \ -n ${ME} -- "$@") if [ $? -ne 0 ] # no success @@ -1343,6 +1361,7 @@ while true do case "$1" in -c|--command) COMMAND=1; HEADER=0; shift;; + -e|--ext) EXTENSION=1; shift;; -g|--debug-mode) DEBUG_MODE=1; shift;; -h|--help) show_usage ;; -n|--no-header) HEADER=0; shift;; @@ -1366,7 +1385,7 @@ if [ -n "${OUTFILE}" ] then if [ -f "${OUTFILE}" ] then - echo -e "%--> file \"${OUTFILE}\" already exists, creating backup" + echo "%--> file \"${OUTFILE}\" already exists, creating backup" mv ${OUTFILE} ${OUTFILE}~ fi exec > ${OUTFILE} # redirect stdout to ${OUTFILE} @@ -1376,90 +1395,14 @@ fi # now take all remaining arguments (should be all filenames) and do the job for arg do - echo -e "%-->" processing file \"$arg\" 1>&2 # echo the current + echo "%-->" processing file \"$arg\" 1>&2 # echo the current # filename to stderr do_the_job $arg done ### listings-ext.sh ends here -% \end{macrocode} ^^A $ -% \iffalse % -% \fi -% -% -% \changes{v16}{09/08/18}{enhanced the .el-file} -% \subsection[AUC\TeX{} Style file]{Style file for AUC\TeX{} to ease the -% Editing with \XEmacs{}} -% \label{sec:AUCTeX} -% -% \XEmacs{} and the package AUC\TeX{} -% (\url{http://www.gnu.org/software/auctex/}) form a powerful tool for -% creating and editing of \TeX/\LaTeX{} files. If there is a suitable -% AUCTeX style file for a \LaTeX{} package like the hereby provided -% \listingsextSty{} package, then there is support for many common -% operations like creating environments, inserting macros, prompting for -% arguments and so on. The following elisp code provides such a style -% file; it must be copied to a place, where \XEmacs{} can find it after its -% creation.% -% -% This file is still in a development phase, i.\,e. one can work with it, -% but there is a couple of missing things as for example font locking or -% the automatic insertion of \cs{switch} commands according to the user's -% input. -% -% \iffalse -%<*auctex> -% \fi -% \begin{macrocode} -;;; listings-ext.el --- AUCTeX style for `listings-ext.sty' - -;; Copyright (C) 2008-2009 Free Software Foundation, Inc. - -;; Maintainer: Jobst Hoffmann, -;; $Author: ax006ho $ -;; $Date: 2009-08-31 20:30:48 +0200 (Mo, 31 Aug 2009) $ -;; $Revision: 48 $ -;; Keywords: tex - -;;; Commentary: -;; This file adds support for `listings-ext.sty' - -;;; Code: -(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)) - (add-to-list 'font-latex-match-function-keywords-local "lstcheck") - (add-to-list 'font-latex-match-function-keywords-local "lstdef") - (add-to-list 'font-latex-match-function-keywords-local "lstuse") - (font-latex-match-function-make) - ;; For syntactic fontification, e.g. verbatim constructs - (font-latex-set-syntactic-keywords) - ;; Tell font-lock about the update. - (setq font-lock-set-defaults nil) - (font-lock-set-defaults)))) - -;; preparing of environments isn't necessary - -;; support for options -(defvar LaTeX-listings-package-options nil - "Package options for the listings package.") - -;;; listings-ext.el ends here. -% \end{macrocode} -% \iffalse -% -% \fi +% \end{macrocode} ^^A $ % % % \subsection[Example/Test Files]{Example and Test Files For Testing The Macros} @@ -1474,10 +1417,8 @@ done % \label{sec:small-java-example-correct} % % The correct (Java) source file is -% \iffalse -%<*example1> -% \fi % \begin{macrocode} +%<*example1> package application.helloworld; // be: packages import java.util.Locale; @@ -1506,10 +1447,8 @@ public class HelloWorld System.out.printf("%s\n", greetings); } // end of method "main(String[] args)" } // end of class "HelloWorld" -% \end{macrocode} -% \iffalse % -% \fi +% \end{macrocode} % We have two correct groups, the output for |-c| should contain % two lines like %\begin{verbatim} @@ -1523,10 +1462,8 @@ public class HelloWorld % % A small \LaTeX-file to test this case is % -% \iffalse -%<*test1> -% \fi % \begin{macrocode} +%<*test1> \documentclass[a4paper,12pt]{article} \usepackage[T1]{fontenc} \usepackage{listings-ext} @@ -1534,22 +1471,18 @@ public class HelloWorld \input{listings-ext.lst} \lstuse[style=bw-code, language=Java]{listingsExtExmplAC} \end{document} -% \end{macrocode} -% \iffalse % -% \fi +% \end{macrocode} % % -% \subsubsection{A Small Java-Example With Wrong Initialisation} +% \subsubsection{Small Java-Examples With Wrong Initialisation or Ending} % \label{sec:small-java-example-wrong-initialisation} % % In the following Java source code the initial tag \verb*-be: - is % missing. Processing the file by |listings-ext.sh| must give an % appropriate error message. -% \iffalse -%<*example2> -% \fi % \begin{macrocode} +%<*example2> // ee: package declaration package application.helloworld; // ee: package declaration @@ -1578,18 +1511,51 @@ public class HelloWorld System.out.printf("%s\n", greetings); } // end of method "main(String[] args)" } // end of class "HelloWorld" -% \end{macrocode} -% \iffalse % -% \fi +% \end{macrocode} +% +% \changes{v56}{10/03/09}{added test case for missing "ee" declarations} +% In the following Java source code the closing tag \verb*-ee: - is +% missing. Processing the file by |listings-ext.sh| must give an +% appropriate error message. +% \begin{macrocode} +%<*example3> +package application.helloworld; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * HelloWorld.java + */ + +public class HelloWorld +{ + // be: specific constructor + public HelloWorld() + { + System.out.println("Object HelloWorld created"); + } // end of specific constructor "HelloWorld()" + // ee: specific constructor + + // be: the main method + public static final void main(final String[] args) + { + String baseName = "HelloWorld"; + ResourceBundle rb = ResourceBundle.getBundle(baseName); + String greetings = rb.getString("hello_msg"); + System.out.printf("%s\n", greetings); + } // end of method "main(String[] args)" +} // end of class "HelloWorld" +% +% \end{macrocode} % % \subsubsection{A Small Java-Example With Correct Grouping} % \label{sec:small-java-example-correct} % -% \iffalse -%<*example3> -% \fi +% \changes{v58}{10/05/18}{corrected example 4} % \begin{macrocode} +%<*example4> package application.helloworld; // be: packages import java.util.Locale; @@ -1607,8 +1573,8 @@ import java.util.ResourceBundle; * @author N.N. * @version : 0.0$ */ -// ee: comment -// ee: class declaration +// ee: introductory comment +// be: class declaration public class HelloWorld // ee: class declaration { @@ -1629,10 +1595,8 @@ public class HelloWorld System.out.printf("%s\n", greetings); } // end of method "main(String[] args)" } // end of class "HelloWorld" +% % \end{macrocode} -% \iffalse -% -% \fi % % \changes{v11}{09/04/15}{added a test for combine mode} % \subsubsection{A Small Java-Example With Correct Grouping, Showing the @@ -1650,10 +1614,8 @@ public class HelloWorld % /listings-ext/listings-ext_test_a.java}{23-26} %\end{verbatim} % -% \iffalse -%<*example4> -% \fi % \begin{macrocode} +%<*example5> // ce: combine /** * HelloWorld.java @@ -1677,10 +1639,8 @@ public class HelloWorld // be: the class } // end of class "HelloWorld" // ee: the class +% % \end{macrocode} -% \iffalse -% -% \fi % % The result of the call |listings-ext.sh -c -o listings-ext_test_d.java| % must contain the lines @@ -1701,10 +1661,8 @@ public class HelloWorld % % So a small \LaTeX-file to test this case is % -% \iffalse -%<*test2> -% \fi % \begin{macrocode} +%<*test2> \documentclass[a4paper,12pt]{article} \usepackage[T1]{fontenc} \usepackage[style=colored-code]{listings-ext} @@ -1712,11 +1670,81 @@ public class HelloWorld \lstcheck{listingsExtExmplDC}{listings-ext.lst} \lstuse[language=Java]{listingsExtExmplDC} \end{document} -% \end{macrocode} -% \iffalse % -% \fi +% \end{macrocode} +% +% +% \changes{v16}{09/08/18}{enhanced the .el-file} +% \subsection[AUC\TeX{} Style file]{Style file for AUC\TeX{} to ease the +% Editing with \XEmacs{}} +% \label{sec:AUCTeX} +% +% \XEmacs{} and the package AUC\TeX{} +% (\url{http://www.gnu.org/software/auctex/}) form a powerful tool for +% creating and editing of \TeX/\LaTeX{} files. If there is a suitable +% AUCTeX style file for a \LaTeX{} package like the hereby provided +% \listingsextSty{} package, then there is support for many common +% operations like creating environments, inserting macros, prompting for +% arguments and so on. The following elisp code provides such a style +% file; it must be copied to a place, where \XEmacs{} can find it after its +% creation.% +% +% This file is still in a development phase, i.\,e. one can work with it, +% but there is a couple of missing things as for example font locking or +% the automatic insertion of \cs{switch} commands according to the user's +% input. +% +% \begin{macrocode} +%<*auctex> +;;; listings-ext.el --- AUCTeX style for `listings-ext.sty' + +;; Copyright (C) 2008-2010 Free Software Foundation, Inc. + +;; Maintainer: Jobst Hoffmann, +;; $Author: ax006ho $ +;; $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $ +;; $Revision: 58 $ +;; Keywords: tex + +;;; Commentary: +;; This file adds support for `listings-ext.sty' + +;;; Code: +(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)) + (add-to-list 'font-latex-match-function-keywords-local "lstcheck") + (add-to-list 'font-latex-match-function-keywords-local "lstdef") + (add-to-list 'font-latex-match-function-keywords-local "lstuse") + (font-latex-match-function-make) + ;; For syntactic fontification, e.g. verbatim constructs + (font-latex-set-syntactic-keywords) + ;; Tell font-lock about the update. + (setq font-lock-set-defaults nil) + (font-lock-set-defaults)))) + +;; preparing of environments isn't necessary + +;; support for options +(defvar LaTeX-listings-ext-package-options nil + "Package options for the listings-ext package.") + +;;; listings-ext.el ends here. +% +% \end{macrocode} % +% +% \changes{v50}{10/02/15}{small changes to the Makefile: main documentation now in .pdf-format} % \changes{v47}{09/08/31}{removed unnecessary files from the distribution} % \changes{v45}{09/08/31}{some small corrections for the test files} % \changes{v41}{09/08/27}{Makefile: removed TODO from the distributed tar-file} @@ -1744,10 +1772,8 @@ public class HelloWorld % % \changes{v03}{08/02/27}{remove the intermediate PostScript file after % generating the .pdf-output from it} -% \iffalse -%<*makefile> -% \fi % \begin{macrocode} +%<*makefile> #----------------------------------------------------------------------- # Purpose: generation of the documentation of the listings-ext package # Notice: this file can be used without any change only with dmake and @@ -1781,7 +1807,7 @@ public class HelloWorld # version information # # Author: Jobst Hoffmann, Fachhochschule Aachen, Standort Juelich -# $Date: 2009-08-31 20:30:48 +0200 (Mo, 31 Aug 2009) $ +# $Date: 2010-05-18 16:23:40 +0200 (Di, 18 Mai 2010) $ #----------------------------------------------------------------------- # The texmf-directory, where to install new stuff (see texmf.cnf) @@ -1807,7 +1833,7 @@ TEXHASH=texhash # change this to the directory which contains the graphic files GRAPHICPATH=. -######### Edit following only, if you want to change defaults! +######### Edit the following only, if you want to change defaults! # The directory, where to install *.cls and *.sty CLSDIR=$(INSTALLTEXMF)/tex/latex/jhf/$(PACKAGE) @@ -1928,12 +1954,12 @@ examples: rm $$f.dvi $$f.ps; \ done -install: $(PACKAGE).dtx $(PACKAGE).dvi +install: $(PACKAGE).dtx $(PACKAGE).pdf [ -d $(CLSDIR) ] || mkdir -p $(CLSDIR) [ -d $(DOCDIR) ] || mkdir -p $(DOCDIR) [ -d $(SRCDIR) ] || mkdir -p $(SRCDIR) cp $(PACKAGE).sty $(CLSDIR) - cp $(PACKAGE).dvi $(DOCDIR) + cp $(PACKAGE).pdf $(DOCDIR) cp $(PACKAGE).ins $(SRCDIR) cp $(PACKAGE).dtx $(SRCDIR) cp $(PACKAGE)_{exmpl,test}_* $(SRCDIR) @@ -1974,10 +2000,8 @@ tar-dist: $(DISTRIBUTION_FILES) $(VERSION_L) > THIS_IS_VERSION_$(VERSION_S); \ tar cfvz $(PACKAGE)-$(VERSION_S).tgz $^ THIS_IS_VERSION_*; \ rm getversion.log -% \end{macrocode} -% \iffalse % -% \fi ^^A $ +% \end{macrocode} ^^A $ % % The following line -- stripped off as |listings-ext.makemake| -- can % be used with the command @@ -1986,23 +2010,26 @@ tar-dist: $(DISTRIBUTION_FILES) % \end{verbatim} % to generate the file |Makefile|, which can be further used to % generate the documentation with a common |make| like the GNU |make|. -% \iffalse +% \changes{v58}{10/05/18}{changed the .setup contents} +% \begin{macrocode} %<*setup> -% \fi -%\begin{verbatim} +#! /bin/sh + sed -e "`echo \"s/^ /@/g\" | tr '@' '\011'`" listings-ext.mk > Makefile && \ rm listings-ext.mk -%\end{verbatim} -% \iffalse % -% \fi +% \end{macrocode} +% +% +% \changes{v50}{10/02/15}{added title to the section "getting the revision"} +% \subsection{Automated Determining of the Revision Number} +% \label{sec:automated-determining} +% % The purpose of the following file is to determine the version of the % package for the case of creating a distribution version of the package. % \changes{v33}{09/08/23}{changed getversion.tex: introduced the date} -% \iffalse -%<*getversion> -% \fi % \begin{macrocode} +%<*getversion> \documentclass{ltxdoc} \nofiles \usepackage{listings-ext} @@ -2010,10 +2037,8 @@ sed -e "`echo \"s/^ /@/g\" | tr '@' '\011'`" listings-ext.mk > Makefile && \ \typeout{VERSION \fileversion\space of \filedate} \begin{document} \end{document} -% \end{macrocode} -% \iffalse % -% \fi +% \end{macrocode} % % \Finale % diff --git a/Master/texmf-dist/source/latex/listings-ext/listings-ext.ins b/Master/texmf-dist/source/latex/listings-ext/listings-ext.ins index 603d9105e86..dc480f8e4d2 100644 --- a/Master/texmf-dist/source/latex/listings-ext/listings-ext.ins +++ b/Master/texmf-dist/source/latex/listings-ext/listings-ext.ins @@ -1,5 +1,5 @@ %% -%% $Revision: 44 $ +%% $Revision: 55 $ %% %% This file will generate fast loadable files and documentation %% driver files from the .dtx files in this package when run through @@ -19,8 +19,8 @@ \preamble -Copyright (C) 2008-2009 Jobst Hoffmann, ------------------------------------------------------------------ +Copyright (C) 2008-2010 Jobst Hoffmann, , all rights reserved +-------------------------------------------------------------------------------------- This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.2 @@ -34,7 +34,7 @@ version 1999/12/01 or later. Please address error reports and any problems in case of UNCHANGED versions to - j.hoffmann@fh-aachen.de + j.hoffmann (at) fh-aachen.de \endpreamble \declarepostamble\examplepost @@ -74,6 +74,7 @@ to \file{listings-ext_exmpl_b.java}{\from{listings-ext.dtx}{example2}} \file{listings-ext_exmpl_c.java}{\from{listings-ext.dtx}{example3}} \file{listings-ext_exmpl_d.java}{\from{listings-ext.dtx}{example4}} + \file{listings-ext_exmpl_e.java}{\from{listings-ext.dtx}{example5}} \file{listings-ext_test_a.tex}{\from{listings-ext.dtx}{test1}} \file{listings-ext_test_d.tex}{\from{listings-ext.dtx}{test2}} } -- cgit v1.2.3