🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #1603

Re: troff string register interpolation if strange char

#1603
From: Vidiot
Date: Fri, 08 Jun 1990 02:05
57 lines
2169 bytes
In article <16321@smunews.UUCP> leff@.seas.smu.edu (leff) writes:
<A strange control character is being inserted on character interpolations
<before a closing \} of an if statement.
<
<In the example below, there are two operations involving interpolation of a
<string register before a \} of an if.  In the first operation, the output of 
<the "tm" inside of the macro, M1, includes both an X and a control character.
<
<The second operation shows that the string register X2 receives both an X
<and a control character.  
<
<I have experienced this problem with both nroff and ditroff.
<
<nroff inserts an octal 36 (^^) while ditroff inserts a control-Q.
<
<The obvious workaround is to insert a dummy statement just before the \}
<but I would like to understand what is happening.  Any ideas?
<
<.de M1
<.if X\\n(R1X1X \{\
<.tm \\*(U1\}
<.if X\\n(R1X1X \{\
<.ds X2 \\*(U1\}
<..
<.ds U1 X
<.nr R1 1
<.M1
<.tm \*(X2X

I have read somewhere that doing what you do is incorrect.  I too ran into
and problem and have solved it by doing:

.de M1
.if X\\n(R1X1X \{\
.tm \\*(U1
.\}
.if X\\n(R1X1X \{\
.ds X2 \\*(U1
.\}
..

The . in front of the \} makes it look like a n/troff command.  But since it
isn't, it is ignored, ie, a blank line isn't put into the output.  The \}
is still seen and operated on.

Your examples can best be re-written as:

.de M1
.if X\\n(R1X1X .tm \\*(U1
.if X\\n(R1X1X .ds X2 \\*(U1
..

The \{\ and \} are best used for multi-line if continuations.
-- 
      harvard\     att!nicmad\        spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INET:<@spool.cs.wisc.edu,@astroatc:brown@vidiot>
Technical Details
Message-ID: <523@vidiot.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!jarthur!elroy.jpl.nasa.gov!sdd.hp.com!zaphod.mps.ohio-state.edu!uwm.edu!uwvax!astroatc!vidiot!brown
References: <16321@smunews.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!jarthur!elroy.jpl.nasa.gov!sdd.hp.com!zaphod.mps.ohio-state.edu!uwm.edu!uwvax!astroatc!vidiot!brown
From: brown@vidiot.UUCP (Vidiot)
Newsgroups: comp.text
Subject: Re: troff string register interpolation if strange char
Message-ID: <523@vidiot.UUCP>
Date: 8 Jun 90 02:05:27 GMT
References: <16321@smunews.UUCP>
Reply-To: brown@vidiot.UUCP (Vidiot)
Organization: Vidiot's Hangout
Lines: 57