🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #2035

Re: reserving registers from within macros

#2035
From: Eamonn McManus
Date: Thu, 03 Sep 1992 12:51
46 lines
2713 bytes
carlisle@cs.man.ac.uk (David Carlisle) writes:
>Arghhhh! Down with \outer'ness!

Absolutely.  As it stands, \outer tokens are just much more trouble
than they are worth.  If TeX had something like METAFONT's commands
for switching between inner- and outer-ness, or a way to say "I know
that the following token is \outer and I can deal with it", I could
bear them.  As it is, I tend to include this file when doing macro
programming, and forget about the problem:

% unouter.tex - remove the concept of \outer from plain TeX
% By Eamonn McManus Nov 88.  This file is not copyrighted.

% This macro removes the outerness of the control sequence \csname#1\endcsname
% by copying it to \csname un*#1\endcsname and then defining
% \csname#1\endcsname to be a macro that expands to that.  For example,
% after \unouter{proclaim}, we have: \proclaim=macro:->\un*proclaim .
% and \un*proclaim=\outer macro:->[original definition of \proclaim] .
% It would be nice if we could avoid this extra level, but I know of no way
% of doing that short of writing the \meaning to a file and reading that in
% again (yeuch).
\def\unouter#1{\toks0=\expandafter{\csname un*#1\endcsname}%
	\edef\next{\let\the\toks0=}\expandafter\next\csname#1\endcsname
	\expandafter\edef\csname#1\endcsname{\the\toks0}}

% In the case where the macro has no parameter text, we can unouter it
% directly by putting its expansion into a token list and redefining it
% in terms of that expansion.
\def\simpunouter#1{%
	\toks0=\expandafter\expandafter\expandafter{\csname#1\endcsname}%
	\expandafter\edef\csname#1\endcsname{\the\toks0}}

% ^^L is defined as \outer\par
\let^^L=\par

% Change everything else defined as \outer.
\simpunouter{newcount} \simpunouter{newdimen} \simpunouter{newskip}
\simpunouter{newmuskip} \simpunouter{newbox} \simpunouter{newtoks}
\simpunouter{newread} \simpunouter{newwrite} \simpunouter{newfam}
\simpunouter{+} \simpunouter{bye}
\unouter{newhelp} \unouter{newif} \unouter{beginsection} \unouter{proclaim}

% \unouter no longer needed, and remove the offending primitive!
\let\unouter=\undefined \let\simpunouter=\undefined \let\outer=\relax

\endinput
Technical Details
Message-ID: <innerial@vadier.gr.osf.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!paperboy.osf.org!gr.osf.org!emcmanus
References: <repasky.715398745@sun.bdc.ubc.ca> <1992Sep2.040517.18955@cs.cornell.edu> <CARLISLE.92Sep2100731@r8d.cs.man.ac.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!paperboy.osf.org!gr.osf.org!emcmanus
From: emcmanus@gr.osf.org (Eamonn McManus)
Subject: Re: reserving registers from within macros
Message-ID: <innerial@vadier.gr.osf.org>
Sender: news@osf.org (USENET News System)
Organization: Open Software Foundation Research Institute, Grenoble
References: <repasky.715398745@sun.bdc.ubc.ca> <1992Sep2.040517.18955@cs.cornell.edu> <CARLISLE.92Sep2100731@r8d.cs.man.ac.uk>
Date: Thu, 3 Sep 1992 12:51:22 GMT
Lines: 46