diff options
author | Karl Berry <karl@freefriends.org> | 2006-10-07 20:34:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-10-07 20:34:51 +0000 |
commit | 60a45a6e821196e03a1b74a69b6b5821693288aa (patch) | |
tree | 6561dd6a85e9f34421a40fabdf3d42d6b759035f /Master/texmf-dist/source | |
parent | 07f227511dcbf1e141f45c38947c6430d58e8012 (diff) |
msg v0.40 update (6oct06)
git-svn-id: svn://tug.org/texlive/trunk@2265 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/msg/Makefile | 25 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/msg/msg.dtx | 328 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/msg/msg.ins | 8 |
3 files changed, 250 insertions, 111 deletions
diff --git a/Master/texmf-dist/source/latex/msg/Makefile b/Master/texmf-dist/source/latex/msg/Makefile new file mode 100644 index 00000000000..60303250f35 --- /dev/null +++ b/Master/texmf-dist/source/latex/msg/Makefile @@ -0,0 +1,25 @@ +# Makefile for TeXLive preparation + +# Here are the default directories; you can modify them here or provide +# new values via the command line: make TL LATEXDIR="xxxxx" + +LATEXDIR=./base +DOCDIR=./doc +TESTSDIR=./tests + +TL: + @echo Installation of the "msg" package for the TeX Live + latex msg.ins + mkdir ${LATEXDIR} + mkdir ${DOCDIR} + mkdir ${TESTSDIR} + mv *.sty ${LATEXDIR}/ + mv *-msg.tex ${LATEXDIR}/ + mv *.pdf ${DOCDIR} + mv README ${DOCDIR} + mv msgguide.tex ${DOCDIR} + mv CHANGES ${DOCDIR} + mv msgtest.tex ${TESTSDIR}/ + @echo End of installation of the "msg" package for TL. + +##############################################################
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/msg/msg.dtx b/Master/texmf-dist/source/latex/msg/msg.dtx index 341cf05114b..7843e8b4f40 100644 --- a/Master/texmf-dist/source/latex/msg/msg.dtx +++ b/Master/texmf-dist/source/latex/msg/msg.dtx @@ -9,10 +9,12 @@ % This file has the LPPL maintenance status "maintained". % The current maintainer is Bernard.Gaulle at idris.fr % \fi -% \CheckSum{1278} +% \CheckSum{1333} % \iffalse % \begin{macrocode} %<*README> +%% To unpack this package: latex msg.ins +%% To prepare for TeX Live: make TL %% %% HERE IS THE MSG PACKAGE FOR LaTeX %% @@ -70,15 +72,28 @@ %% \issueallmsg[msg_macro](<package>) %% and all messages from the file will be retrieved and issued. %% +%% For tracing all accessed files you should load the "msg" package with +%% the option: tracefiles. +%% +%% In case of trouble you can ask the "msg" package not to load +%% any message file, just load the "msg" package with the +%% option: noop, and then you just obtain a message containing +%% the "msgid". +%% +%% Please look at the documentations for more details. +%% %</README> % \end{macrocode} % \fi % \catcode`\<=\active\def<{$\langle$} % \catcode`\>=\active\def>{$\rangle$} % \def\msgname{``\textsf{msg}''} -% \title{The \LaTeXe\ \msgname\ package\\ +% \title{\vspace*{-1cm}The \LaTeXe\ \msgname\ package\\ % for package localization\thanks{This file has version -% \fileversion\ last revised \filedate}} +% \fileversion\ last revised \filedate}\\[0.25\baselineskip] +% \ifguide\textit{Package writer's guide} +% \else\textit{Comprehensive documentation} +% \fi} % \author{Bernard \textsc{Gaulle}} % \date{As of \filedate % \vfill{\small\tableofcontents}} @@ -91,12 +106,11 @@ % to provide a feature to localize any \LaTeXe\ package or document class. % The \msgname\ package is designed for that. % Messages are in dedicated files and retrieved when needed.\\ -% \textbf{This is a preliminary release} for the packages programmers; -% \textbf{feel free to send evaluation or bug reports and even -% corrections or improvements} at |<gaulle@idris.fr>|; -% i will coordinate the changes. -% \StopEventually{} +% +% Packages writers (as well as document class writers) just have to create +% their native messages file and ask for any message when needed. % +% \ifguide\else % \section{The documentation driver} % % This code will generate the documentation. Since it is the first piece of @@ -105,6 +119,7 @@ % % We just load the \msgname\ package for self testing purposes (which needs % we keep track of the |doc|'s |\MakePercent| macros later used). +% \fi % \begin{macrocode} %<*driver> \documentclass[10pt]{ltxdoc} @@ -113,15 +128,23 @@ \let\msg@MPI\MakePercentIgnore \makeatother \usepackage[T1]{fontenc} - \usepackage{lmodern,makeidx} + \usepackage{lmodern}% You can remove it if you don't have that font. + \usepackage{makeidx} \usepackage[tracefiles]{msg} % \usepackage{msg}% should also be tested without "tracefiles" \begin{document} + \let\hard\relax\let\endhard\relax\let\ifguide\iffalse \DocInput{msg.dtx} \end{document} %</driver> % \end{macrocode} +% +% \ifguide\else +% A package writer's guide can also be typeset using the file +% |msgguide.tex|. +% \fi % +% \ifguide\else % \section{Initialization} % % Check if the msg package is already loaded and if yes end input. @@ -130,27 +153,31 @@ % will be |\typeout| if not already initiated. Force the \texttt{inputenc} % package to be loaded, if not already done and even from a Babel option % since it could issue messages via our \msgname\ package. +% \fi % % \begin{macrocode} %<*code> \iffalse checksum part %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% -%% checksum = "54410 1466 6398 61162" +%% checksum = "21854 1564 6785 65053" %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi -\def\fileversion{V0.20}\def\filedate{2005/01/24}% +\def\fileversion{V0.40}\def\filedate{2006/10/03}% \ifx\issuemsg\undefined\else\expandafter\endinput\fi% \ifnum\catcode`\@=11\else\expandafter\catcode`\@=11\fi% -\ifx\LdfInit\@undefined% We need inputenc package. - \RequirePackage{inputenc}% Usually, load that package. -\else% But with Babel, dont use \usepackage or such, - \let\@msg@tempa\@currname% Save current package name. - \xdef\@currname{inputenc}% set package req. - \@@input inputenc.sty% and input it now. - \makeatletter% - \let\@currname\@msg@tempa% Reset original package name. +\ifx\kbencoding\undefined% If we don't have any keyboard reencoding + \ifx\LdfInit\@undefined% we need at least inputenc package. + \RequirePackage{inputenc}% Usually, load that package. + \else% But with Babel, dont use \usepackage or such, + \let\@msg@tempa\@currname% Save current package name. + \xdef\@currname{inputenc}% set package req. + \@@input inputenc.sty% and input it now. + \makeatletter% + \let\@currname\@msg@tempa% Reset original package name. + \fi% + \let\@previeg\empty% We have no encoding at this time. \fi% % \end{macrocode} % \begin{macro}{\issuemsgio} @@ -159,12 +186,14 @@ % \end{macrocode}\label{msgio} % \end{macro} % +% \ifguide\else % Verify that |\languagename| which is % set by \texttt{babel} or \texttt{mlp} or \texttt{frenchpro} % or \texttt{frenchle} or \ldots % is not a virtual language such as % |dummy| or |nohyphenation| and then keep it as % the \msgname\ package's language name. +% \fi % % \begin{macrocode} \def\@msg@tempa{dummy}% @@ -180,6 +209,7 @@ \fi% \fi% % \end{macrocode} +% \ifguide\else % \begin{macro}{\packagewarningheader}|#1| % This code is designed to localize text of macro |\PackageWarning| which % we, now, redefine. @@ -193,9 +223,10 @@ } % \end{macrocode} % \end{macro}\label{pw} -% +% % Few other internal \LaTeX\ macros might be localized here... but preferably % within the kernel. +% \fi % % \begin{macrocode} \edef\@msg@code@ast{\the\catcode`\*}% Save the current catcode of ``*''. @@ -203,7 +234,7 @@ % % \section{Macros to be used in a \LaTeX\ package} % -% Basically, three macro commands can be coded for package localization: +% Basically, three macro commands can be coded for package localization:\\ % |\issuemsg|, |\getmsg| and |\retrievemsg|. % Another macro, |\issuemsgx| is given for specific cases, we will see % that later, page \pageref{encodings}. @@ -211,7 +242,8 @@ % \subsection*{Output a message} % % Here is the main macro which will issue a message ``id'' via the -% command |\issuemsgio| defaultly set to |\typeout| (cf page~\pageref{msgio}). +% command |\issuemsgio| defaultly set to |\typeout| +% \ifguide.\else(cf page~\pageref{msgio}).\fi % \begin{macro}{\issuemsg}|[#1]#2(#3)[#4]| % \begin{macro}{\issuemsgx}|[#1]#2(#3)[#4]| % \begin{macrocode} @@ -226,18 +258,18 @@ % by the way of the first optional argument. The second argument is the % message ``id''; the third is the name of the package (or document % class\footnote{Each time we are talking about a \LaTeX\ package, please -% consider it applies also to any \LaTeX\ document class.} +% consider it applies also to any \LaTeX\ document class.}) % which provides that message through a % message file whose name is |[language_]package-msg.tex|. Lastly an optional % parameter can be set to ``|#1|\footnote{You can put here -% any replacement text instead of this \texttt{\#1} parameter. Be carefull, +% any replacement text instead of this \texttt{\#1} parameter. Be careful, % this parameter or replacement text will be, usually, expanded; so % protect any string which should not with a \texttt{\textbackslash string} % prefix.}'' to forward an argument % directly inside the message content. I thought the syntax would be too % much complicated to offer much more parameters through that mean. % We will see later that the message can also be split in four parts, -% allowing anyone to display the message differently but no as +% allowing anyone to display the message differently but not as % |\issuemsg| does. % % \begin{center} @@ -247,7 +279,7 @@ % The message macro could be the usual |\typeout| or any other output macro % with one argument such as |\message| or |\wlog|. % You can also code a macro with two arguments, such as |\ClassWarning|, -% |\ClassWarningNoLine|, |\PackageWarning|, |\PackageWarningNoLine| +% |\ClassWarningNoLine|, |\PackageWarning|, |\PackageWarningNoLine|, % |\ClassInfo| or |\PackageInfo| which have just a name as first argument, % like this: % @@ -260,7 +292,8 @@ % % You can also use special error macros with 3 arguments as explained below. % -% \subsection*{Willing to issue a \texttt{\textbackslash PackageError}?} +% \subsection*{Willing to issue a +% {\mdseries\texttt{\textbackslash PackageError}}?} % \label{willingPE} % % The \msgname\ package is designed for basic macro messages which have @@ -329,28 +362,10 @@ \fi% % \end{macrocode} % -% There is a different expansion when basic \TeX\ control sequence are -% given as the output macro since they require the argument token should -% begin and end with a brace. -% -% \begin{macrocode} -\def\@msg@tempa{#1}% TeX cs requires {arg}: -\def\@msg@tempb{\message}% -\ifx\@msg@tempa\@msg@tempb% - \def\@msg@txt{{% - \themsg\themsgi\themsgii\themsgiii% - }}% -\fi% -\def\@msg@tempb{\errmessage}% -\ifx\@msg@tempa\@msg@tempb% - \def\@msg@txt{{% - \themsg\themsgi\themsgii\themsgiii% - }}% -\fi% -% \end{macrocode} -% +% \ifguide\else % Here, we check for error macros and, if any, set the flag for % further processing. +% \fi % % \begin{macrocode} \let\@msg@txt@\empty% @@ -362,9 +377,11 @@ \fi% % \end{macrocode} % +% \ifguide\else % Now we test if the output macro name provided is well defined ; if not % we retrieve our own message \#1 in place of requested one, otherwise % we call the |\retrievemsg| macro and output the message text parts. +% \fi % % \begin{macrocode} \ifx\@msg@tempb\ClassError% The same for \ClassError. @@ -373,9 +390,12 @@ \ifx\undefined#1\retrievemsg2(msg)% \PackageWarning{msg}\@msg@txt% \else\retrievemsg#2(#3)[#4]% - \edef\@msg@txt{\@msg@txt}% - \edef\@msg@txt@{\@msg@txt@}% + \ifx\kbencoding\undefined% Expand text now if + \edef\@msg@txt{\@msg@txt}% output encoding is + \edef\@msg@txt@{\@msg@txt@}% not available. + \fi% \@relaxORgobble\@msg@iocmd{\@msg@txt}{\@msg@txt@}% +%%% \csname @originalkbe\endcsname% Get back encoding if necessary. \fi% \let\MessageBreak\@msg@MBori% }% @@ -402,8 +422,10 @@ % \centerline{`\textsl{\getmsg1(msg)}'} % \egroup % +% \ifguide\else % Here is the very simple code for |\getmsg|; just a |\retrievemsg| and % the expansion of the message when correctly retrieved. +% \fi % % \begin{macro}{\getmsg}|#1(#2)[#3]| % \begin{macrocode} @@ -418,9 +440,10 @@ % % To avoid having superfluous file names listed in the \texttt{log} % each time we request a message from a file, defaultly we read the -% file with the \TeX\ |\read| command, as the following. +% file with the \TeX\ |\read| command\ifguide.\else, as the following. % This code will not be used when the option |tracefiles| is given (in % which case we will input the message file with an usual |\input| macro). +% \fi % \label{readcode} % % \begin{macrocode} @@ -438,12 +461,21 @@ \let\msgtrailerOLD\msgtrailer% \let\msgencodingOLD\msgencoding% \let\spaceOLD\space% + \let\UTFviii@two@octetsOLD\UTFviii@two@octets% + \let\UTFviii@two@octetsOLD\UTFviii@two@octets% + \let\UTFviii@four@octetsOLD\UTFviii@four@octets% + \let\UTFviii@two@octets\string% If utf8 was loaded then + \let\UTFviii@three@octets\string% nullify it until + \let\UTFviii@four@octets\string% necessary. \def\msgheader{\protect\msgheader}% \def\msgtrailer{\protect\msgtrailer}% \def\msgencoding{\protect\msgencoding}% - \def\space{\protect\space}% + \def\space{\noexpand\space}% \def\help{\protect\helpi}% \protected@edef\@msg@tempf{\@msg@tempf\@msgline}% + \let\UTFviii@two@octets\UTFviii@two@octetsOLD% + \let\UTFviii@two@octets\UTFviii@two@octetsOLD% + \let\UTFviii@four@octets\UTFviii@four@octetsOLD% \let\space\spaceOLD% \let\msgheader\msgheaderOLD% \let\msgtrailer\msgtrailerOLD% @@ -459,11 +491,12 @@ % NOTICE: all messages read until the requested one (included) are expanded % (before parsing) in the following macro. Thus, each (|\msg|) macro call % should contain significant value or |\protect| a macro. The same reason -% applies to |\msgheader| and |\msgtrailer| we will defined later (cf +% applies to |\msgheader| and |\msgtrailer| we will discuss later (cf % p~\pageref{msgtrailerdef}). % % \begin{macrocode} - \newread\@inputmsg% + \let\endinputORI\endinput% Save \endinput for any use in an alone \msgencoding + \newread\@inputmsg% We'll need it at least for the banner message. \def\@@input@msg@filename{% Doing nearly like \@@input\msg@filename \openin\@inputmsg=\msg@filename\@msg@moretrue% \let\msgparti\relax% @@ -501,8 +534,10 @@ % In fact, if this is a one-part message it will be saved % in |\themsg|, otherwise this will be the first part message and other parts % will be saved in |\themsgi|, |\themsgii| and |\themsgiii|. +% \ifguide\else % This will be achieved via the |\retrievemsg| macro defined as the % following: +% \fi % % \begin{macro}{\retrievemsg}|#1(#2)[#3]| % \begin{macrocode} @@ -552,16 +587,14 @@ \fi% \edef\msg@inputlineno{the\inputlineno}% \makeatletter% - \let\@msg@gobble@space\relax% Req. when \msgheader in first line. + \let\@msg@gobble@space\relax% Case \msgheader in 1st line. \let\reserved@a\@gobble% Avoid runaway. - \bgroup\@@input@msg@filename\relax\egroup% Protected marmelade. + \bgroup\@@input@msg@filename\relax\egroup% \let\msg@cmd\relax% \csname msg@MPI\endcsname% req. when ltxdoc \ifx\themsg\empty% Unusual end of file reached. \def\@msg@tempa{\let\msg@empty\relax% to avoid loop. - \makeatletter% \r@trievemsg6(msg)[]% - \makeatother% }% \expandafter\@msg@tempa% \fi% @@ -632,7 +665,7 @@ % % \section{The message files} % -% The default (english) message files should have the name +% The default (English) message files should have the name % \texttt{\emph{package}-msg.tex} and localized ones should be % \texttt{\emph{language}\_\emph{package}-msg.tex}. % I would have prefered the file names begin with a dot which is @@ -646,6 +679,7 @@ % that when a message is split on multiple lines, each line must end % with "\verb*X %X" to avoid to loose the ending space when any is % required; this is due to the special |\read|ing process shown +% \ifguide.\else % page \pageref{readingprocess}. % % \subsection*{About the \TeX\ Directory Structure} @@ -661,13 +695,14 @@ % also on ISO-9660 CD-ROMs. But, as said Karl Berry: "I rather % doubt TeX Live itself would be usable on an 8.3 filesystem these days". % \bigskip +% \fi % % \subsection*{Message files contents} % % A typical file content is the following |msg-msg.tex| file, used by % the \msgname\ package itself: % -%</code> +%</code>\hard % \begin{macrocode} %<*english> % File: msg-msg.tex @@ -680,9 +715,11 @@ \msg{2}{invalid optional parameter provided:}{} \msg{3}{invalid language requested: ``\CurrentOption''}{} \msg{4}{This is to test the #1 feature}{} -\msg{5}{``msg'' package line number }{\msgparti{issues \#\msgid\ #1 message}} -\msg{6}{msg package: UNUSUAL end of file reached % - when loading \msg@filename\space file!}{} +\msg{5}{``msg'' package line number }{\msgparti{issues % + \#\msgid\ #1 message}} +\msg{6}{msg package: UNUSUAL end of file reached when % + \MessageBreak % + loading \msg@filename\space file!}{} \msg{7}{\string\msg\space syntax error}{\help{last % special test case argument is missing.}} \msgheader{MESSAGE\space\msgid:\space``}\msgtrailer{''} @@ -700,21 +737,20 @@ {\help{Look at rules to apply in messages files.}} \msg{*}{erroneous message id ``\msgid''}{} %</english> -% \end{macrocode} +% \end{macrocode}\endhard % % If necessary, one can link |english_msg-msg| to that file, but since English % is always the default language for \LaTeX\ this is useless. % % The same messages, localized for French, are located in % \label{msgfiles} -% the following |french_msg-msg.tex| file: -% +% the following messages file (|french_msg-msg.tex|): +%\hard % \begin{macrocode} %<*french> % Fichier french_msg-msg.tex % Ici on trouve les messages en francais pour l'extension \msgname\ . % -% La ligne suivante est la juste pour les tests : \msgencoding{latin1}\msgheader{}\msgtrailer{} \msg{1}{\filedate\space chargement de l'extension de % localisation (\fileversion).}{} @@ -724,15 +760,18 @@ \msg{5}{ligne }{\msgparti{de l'extension ``msg'' génère le % message de #1 \#\msgid}} \msg{6}{extension msg \string: fin ANORMALE de fichier rencontrée % + \MessageBreak % en chargeant le fichier \msg@filename\space\string!}{} \msg{7}{erreur de syntaxe à l'appel de \string\msg}% cas special de test {\help{il manque le dernier argument.}} -\msgheader{MESSAGE\space\msgid\space\string:\space\string<\string<\space} +\msgheader{MESSAGE\space\msgid\space\string:\space % + \string<\string<\space} \msgtrailer{\space\string>\string>} \msg{8}{ceci est un message personnalisé}{} \msg{9}{ceci est un message personnalisé % \MessageBreak et aligné}{} -\msgheader{Message\space\msgid\space(msg)\space\string:\space}\msgtrailer{} +\msgheader{Message\space\msgid\space(msg)\space\string: % + \space}\msgtrailer{} \msg*{10}{****** Je mets en valeur \string: % ceci est un AVERTISSEMENT ! ****** % \MessageBreak ****** Soyez prudent.^^J}{} @@ -745,7 +784,7 @@ {\help{Voir les règles à appliquer dans les fichiers de messages.}} \msg{*}{le message id ``\msgid'' n'est pas répertorié}{} %</french> -% \end{macrocode} +% \end{macrocode}\endhard % %<*code> % \bigskip @@ -754,6 +793,7 @@ % since the |\catcode| for |@| is assigned to letter when the message % file is read in. % +% \ifguide\else % As you see, these files mostly contain |\msg| calls with three % arguments, so it's time now to look at this code. % @@ -761,6 +801,7 @@ % |<*...>| tags since they contain an underscore character which % is not protected at this level when using the \textsl{ltxdoc} % document class. +% \fi % % \section{The macros to use in message files} % @@ -800,8 +841,8 @@ \let\themsgiii\empty% message parts. \set@argmsg\@msg@% }% -\def\@gobble@help#1#2{\@msgparts}% Case 2 lines \msg with \read but not \input. -\long\def\@msg@#1{\def\@msg@tempd{% +\def\@gobble@help#1#2{\@msgparts}% Case 2 lines \msg with \read +\long\def\@msg@#1{\def\@msg@tempd{% but not \input. \ifx\@msginput@usual\@@input@msg@filename% \def\space{\noexpand\space}% \protected@edef\msg@header{\msg@header}% @@ -845,7 +886,7 @@ \def\@msg@tempb{\endinput\@msg@tempd% \PackageWarningNoLine{msg}{\themsg% \themsgi\themsgii\themsgiii}% - \let\@relaxORgobble\@gobble}% + \global\let\@relaxORgobble\@gobble}% \else\let\@msgparts@ORnot\@gobble% \fi% \fi% @@ -858,7 +899,7 @@ % |\PackageWarning| with that message, but no line number is sent % because the message file is still not closed and the current line % number is that from the message file. The message is also forwarded -% to the TeX mouth even when an |\issuemsg| was requested. +% to the \TeX\ mouth even when an |\issuemsg| was requested. % % \subsection*{To build a \texttt{\textbackslash PackageError} % or \texttt{\textbackslash ClassError} message} @@ -912,7 +953,9 @@ % materials. When requested via |\getmsg| or |\issuemsg| the four % parts are sticked in the usual order. % +% \ifguide\else % These macros are defined when the last |\msg| argument is read in. +% \fi % % \begin{macrocode} \long\def\@msgparts#1{\def\@msg@tempc{\catcode`\#=6% @@ -972,7 +1015,11 @@ % probably need to avoid macros like |\aa|, |\oe|, |\ae|, etc. which % can't output as expected on the console or log file. % If your messages use 8bits characters, these 8bits characters will -% be output asis. +% be output asis (until the \LaTeX\ team introduces a real output +% encoding for the console\footnote{The \msgname\ package is already designed +% for any output encoding; this is the \texttt{\textbackslash kbencoding} +% macro call which can do that (as currently done by my experimental +% \texttt{keyboard} package).}). % % \subsection*{For messages to be typeset} % @@ -992,7 +1039,8 @@ \def\msgencoding#1{\ifx\empty#1\else% just disactive 8bits chars. \let\iterateORI\iterate% \def\@msg@encoding{#1}% - \ifx\msg@cmd\issuemsg%\inputencoding{ascii}% + \ifx\msg@cmd\issuemsg% If there is not output encoding: + \ifx\kbencoding\undefined%\inputencoding{ascii}% \def\@msgenc@loop##1##2{\@tempcnta`##1\relax% \loop\catcode\@tempcnta=11% \ifnum\@tempcnta<`##2\relax% @@ -1002,11 +1050,22 @@ \@msgenc@loop\^^K\^^K% \@msgenc@loop\^^N\^^_% \@msgenc@loop\^^?\^^ff% 128-255 +%%% \global\let\@originalkbe\relax% + \else% +%%% \xdef\@originalkbe{\noexpand\kbencoding{\@kbencoding}}% + \let\languagename\msg@languagename% + \let\msgidORI\msgid% Save current msgid because + \kbencoding{#1}% it may issue any message. + \let\msgid\msgidORI% Now reset it. + \@msg@moretrue% Continue file reading. + \fi% \else\let\@latex@infoORI\@latex@info% \let\@latex@info\@gobble% \let\endinputBACK\endinput% \let\endinput\endinputORI% - \@msgencoding{#1}% + \let\msgidORI\msgid% Save current msgid because + \@msgencoding{#1}% it may issue any message. + \let\msgid\msgidORI% Now reset it. \let\endinput\endinputBACK% \let\@latex@info\@latex@infoORI% \fi\makeatletter% @@ -1014,7 +1073,19 @@ \fi% }% \let\@msg@encoding\empty% Unknown current encoding. -\AtBeginDocument{\let\@msgencoding\inputencoding}% +\ifx\kbencoding\undefined% + \AtBeginDocument{\let\@msgencoding\inputencoding}% + \let\inputencodingORI\inputencoding% Save \inputencoding code + \def\inputencoding#1{\def\@ieg{#1}\let\exec@ieg\relax% Avoid + \ifx\@ieg\@previeg\else% to load twice + \def\@previeg{#1}% the same encoding file. + \def\exec@ieg{\inputencodingORI\@ieg}% + \fi% + \exec@ieg% + }% +\else% + \AtBeginDocument{\let\@msgencoding\kbencoding}% +\fi% % \end{macrocode} % \subsection*{Disadvantage using \texttt{\textbackslash msgencoding}} % @@ -1024,11 +1095,15 @@ % if any message was already issued by the \msgname\ package and then % an option clash will occur and force you to put the encoding option % as a global option in |\documentclass|. +% +% Since \msgname\ is calling |inputenc| there will be real difficulties +% to localize the |inputenc| package itself. % \end{macro} % % \section*{The messages file rules} % -% Due to the previous |\read| (page \pageref{readcode}) code +% Due to the \ifguide |reading| process \else +% previous |\read| (page \pageref{readcode}) code \fi % you should apply the following rules in % a message file: % \begin{description} @@ -1038,13 +1113,13 @@ % \item [Rule 3:] A |\msg| line can be continued on the next line(s), assuming % each one ends with \verb*X %X. % \item [Rule 4:] The following macros: |\msgheader|, |\msgtrailer|, -% or |\msgencoding| are alwauys executed. +% or |\msgencoding| are always executed. % \item [Rule 5:] Spacing inside |\msgheader| and |\msgtrailer| should be % made only by the use of the macro |\space|. % \item [Rule 6:] Any of these three macros should be expandable at any time. % \item [Rule 7:] No other macro command can begin a line. % \item [Rule 8:] All 8bits characters used should in the range specified -% by the |\msgencoding| macro command. +% by the macro command |\msgencoding|. % \end{description} % That's all! % @@ -1079,7 +1154,9 @@ % have to insert |\MessageBreak| where you want the new line will % start and then the \msgname\ package will try to align the following % text by adding the same number of |\space|s as tokens in the -% expandded |\msgheader|. That feature only applies with |\issuemsg|. +% expanded |\msgheader|. That feature only applies with |\issuemsg| and +% only to the |<|\emph{message-part1}|>| (the three other message parts +% can not have any header or trailer). % % \subsection*{To emphasize a message} % @@ -1171,7 +1248,7 @@ % \section{Testing a message file} % % -% When you are building a message file few typing errors can occur; so +% When you are building a messages file few typing errors can occur; so % there is a need to test that file. You can do this by using the % following macro call: % @@ -1183,10 +1260,10 @@ % macro) but not, perhaps, with the exact macro call which will be used in the % \LaTeXe\ package or document class. Specially, the |\help| macro call % does nothing and |\msgpart|s are listed in the order found in the file. -% You should also notice that all macro used inside the +% You should also notice that all macros used inside the % messages should be expandable. This macro is allways executed with -% the \texttt{tracefiles}% -% \footnote{I never found the right code to avoid a loop with +% the \texttt{tracefiles}\footnote{I never found the right code +% to avoid a loop with % \texttt{tracefiles} option...} option. % % Here is an example using the \msgname\ file @@ -1248,10 +1325,12 @@ % \end{center} % % \begin{macrocode} -\DeclareOption{message}{\let\issuemsgio\message}% TeX cs. -\DeclareOption{wlog}{\let\issuemsgio\wlog}% Plain TeX cs. -\DeclareOption{typeout}{\let\issuemsgio\typeout}% LaTeX cs. -\DeclareOption{kbtypeout}{\let\issuemsgio\kbtypeout}% Keyboard cs. +\ifx\intern@lc@llfrom\undefined% Options aren't declared for internal/kernel calls + \DeclareOption{message}{\let\issuemsgio\message}% TeX cs. + \DeclareOption{wlog}{\let\issuemsgio\wlog}% Plain TeX cs. + \DeclareOption{typeout}{\let\issuemsgio\typeout}% LaTeX cs. + \DeclareOption{kbtypeout}{\let\issuemsgio\kbtypeout}% Keyboard cs. +\fi% % \end{macrocode} % % These options are related to basic messages macros but this @@ -1268,15 +1347,35 @@ % \end{center} % % The \texttt{tracefiles} option changes the processing for reading -% message files. Defaultly these files are not read with the usual +% messages files. Defaultly these files are not read with the usual % |\input| macro and so the files are not listed in the \texttt{log} -% file. When giving the \texttt{tracefiles} option message files +% file. When giving the \texttt{tracefiles} option messages files % are read with a |\input| macro like and then the full path names % are listed. % % \begin{macrocode} -\DeclareOption{tracefiles}{\let\@@input@msg@filename\@msginput@usual% - }% +\ifx\intern@lc@llfrom\undefined% Options aren't declared for internal/kernel calls + \DeclareOption{tracefiles}{\let\@@input@msg@filename\@msginput@usual}% +\fi% +% \end{macrocode} +% +% \section{A special option} +% +% \begin{center} +% \fbox{\texttt{\textbackslash usepackage[<\emph{noop}>]\{msg\}}}% +% \end{center} +% +% The \texttt{noop} option changes the processing: don't read the +% messages files and just provides the "msgid" as text message with +% the following header: |0<msg noop>|. +% +% \begin{macrocode} +\ifx\intern@lc@llfrom\undefined% Options aren't declared for internal/kernel calls + \DeclareOption{noop}{\def\@@input@msg@filename{\xdef\themsg{0}% + \xdef\themsgi{\string<msg noop\string>\space\msgid}% + }% + }% +\fi% % \end{macrocode} % % \section{Language options} @@ -1304,24 +1403,29 @@ % \fbox{\texttt{\textbackslash usepackage[<\emph{output-options}>,native]\{msg\}}}% % \end{center} % +% \ifguide\else % The previous line of code declares |french| as an option for the \msgname\ % package itself. Going this way we redefine |\packagewarning| we set at % the begining page~\pageref{pw} and translate |\on@line| in French. % I don't suggest to do the same for all other languages... this is just % a native language privilege. +% \fi % % \begin{macrocode} \let\on@lineORI\on@line% \let\pwhORI\packagewarningheader% -\DeclareOption{french}{% Mostly a testing option - % or have msg's messages in French. - \@msgINfrench}% +\ifx\intern@lc@llfrom\undefined% Options aren't declared for internal/kernel calls + \DeclareOption{french}{% Mostly a testing option + % or have msg's messages in French. + \@msgINfrench}% +\fi% \def\@msgINfrench{% \def\on@line{ (voir le source, ligne \the\inputlineno)}% \def\packagewarningheader##1{Extension ##1 : ATTENTION, }% \def\msg@languagename{french}}% % \end{macrocode} % +% \ifguide\else % It may occur that the |\languagename| is already set (e.g. in the % \LaTeX\ format), so we test it; if French is set the \msgname\ package will % then speak that language. @@ -1330,16 +1434,18 @@ \edef\@msg@tempa{french}\ifx\languagename\@msg@tempa\@msgINfrench\fi% % \end{macrocode} % Here is the code to process the last option: +% \fi % \begin{macrocode} % Last option will be the msg's language if defined (within the % \texttt{language.dat} file in use). -\DeclareOption*{% Once a language is provided we should - \let\on@line\on@lineORI% reset to default. - \let\packagewarningheader\pwhORI% - \def\@msg@tempa{native}% - \ifx\@msg@tempa\CurrentOption% - \let\msg@languagename\nativelanguage% - \else% +\ifx\intern@lc@llfrom\undefined% Options aren't declared for internal/kernel calls + \DeclareOption*{% Once a language is provided we should + \let\on@line\on@lineORI% reset to default. + \let\packagewarningheader\pwhORI% + \def\@msg@tempa{native}% + \ifx\@msg@tempa\CurrentOption% + \let\msg@languagename\nativelanguage% + \else% \expandafter% \ifx\csname l@\CurrentOption\endcsname\relax% \def\@msg@tempa{\retrievemsg3(msg)\PackageWarningNoLine{msg}% @@ -1348,11 +1454,13 @@ \fi\@msg@tempa% \fi% }% +\fi% % % \end{macrocode} -% The last option, if undeclared, is assumed to be a language name. If that -% language is unknown (i.e. undefined in the \texttt{language.dat} file -% in use) we issue a warning with message number 3, +% The last option, if undeclared as an option, is assumed to be +% a language name. If that language is unknown (i.e. undefined +% in the \texttt{language.dat} file in use) we issue a warning +% with message number 3, % otherwise that language name will be now the prefix for all % the message files names searchs. It overides any previously set % (in format, package, ...) language name for use by the \msgname\ package. @@ -1361,15 +1469,19 @@ % name can't be changed any way inside the document (no language % change can modify that). % +% \ifguide\else % \section{Finally} % % It's time now to process the options, get the \msgname\ package's banner % and issue it as well in the log file. % % That's all for the code. +% \fi % % \begin{macrocode} -\ProcessOptions% Process options +\ifx\intern@lc@llfrom\undefined% No process of options for internal/kernel calls + \ProcessOptions% Process options +\fi% % Retrieve msg: \filedate\ msg package (\fileversion) loaded. \bgroup% Protect from any setting. \retrievemsg1(msg)% @@ -1389,7 +1501,7 @@ % \begin{enumerate} % \item Chose the native language and create the related messages file. % \item Chose the input encoding and define it in the messages file -% with |\msgencoding|. +% with the macro |\msgencoding|. % \item Insert the final error message (|\msg(*){...}{}|). % \item Isolate all messages in the code. % \item Attach to each message a unique \textsl{id}. diff --git a/Master/texmf-dist/source/latex/msg/msg.ins b/Master/texmf-dist/source/latex/msg/msg.ins index d9ebf33f618..3e68b6bb3a8 100644 --- a/Master/texmf-dist/source/latex/msg/msg.ins +++ b/Master/texmf-dist/source/latex/msg/msg.ins @@ -16,8 +16,10 @@ \generateFile{norsk_msg-msg.tex} {t}{\from{msgfiles.dtx}{norsk}} \generateFile{german_msg-msg.tex} {t}{\from{msgfiles.dtx}{german}} \Msg{*****************************************************} -\Msg{* "msg" package now generated, please move msg.sty *} -\Msg{* file and *-msg.tex messages files in the *} -\Msg{* appropriate directory where LaTeX can find them. *} +\Msg{* "msg" package is now generated, please move msg.sty} +\Msg{* file and *-msg.tex messages files in the } +\Msg{* appropriate directory where LaTeX can find them. } +\Msg{* } +\Msg{* For TeX Live please do: "make TL" } \Msg{*****************************************************} \endinput |