🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
7 messages
7 total messages Started by Maxim Spivak Mon, 20 Jun 1994 22:34
Problems with trn macros (used to be 6 questions)
#9630
Author: Maxim Spivak
Date: Mon, 20 Jun 1994 22:34
57 lines
2628 bytes
Hello!

Several months ago there was a post which asked how to perform the 
following operation:
	
	-Enter selector
	-Mark several articles
	-Kill all the other articles (both for this instance and forever)
	-Start reading the selected articles

Wayne Davidson suggested the following macros:

	^A^F %(%m=t?%(%Z=^0?::M^J)/\^/\:Tj^Jq:)
	^A^A %(%m=t?%(%Z=^0?::M^J)/\^/\:Tj^J%(%Z%M=^00?q:Y\^):)
	^A^R %(%m=t?%(%Z=^0?::M^J)/\^/\:Tj^J%(%Z%M=^00?q:YZ):)

However, there are two problems with this solution:
	
1. I've been using the ^A^A macro. When I call it, it seems to kill the 
unselected articles and display the selected ones. However, when I 
reenter the group several days later, the replies to the 
previously-killed articles are back!  

I checked the KILL file, and the thread reference numbers do appear there
(excerpt)
	....
	<Cr08rt.IL7yuma.acns.colostate.edu> TJ
	<1994Jun20.023144.24954@rosevax.rosemound.com> TJ
	<1994Jun10.191117.18514@rosevax.rosemound.com> TJ
	<2tbs2u$fu2@u.cc.utah.edu> TJ
	....
However, after reading the kill-file FAQ, I got the impression that each 
thread should end with `Tj', not 'TJ'. Is this the problem?

2.  Assuming that it needs `Tj', I decided to fix the macro. However, I'm 
kinda stuck with the syntax. In trying the parse the ^A^A macro, I came 
up with these questions:
	-what is `^0'?
	-what does `/\^/\' do?
	-what is `^J'?
	-what is the logical progression of the macro (in other words:
	 what is the pseudocode/logic that makes it work?)
	-why doesn't the macro work? It seems to to a `Tj' on a set of
	 articles?

Anyway, if someone could help me out I'd be very grateful. Also, the man 
page could treat the macros a bit better if it showed a complicated macro 
and stepped through it.

Are there any other macro-related trn docs? I've already seen the 
excellent trn intro by Jon Bell.

Thanks,

Max
--
Max Spivak, Ext 7420
Re: Problems with trn macros (used to be 6 questions)
#9655
Author: Wayne Davison
Date: Wed, 22 Jun 1994 20:01
94 lines
4859 bytes
According to Maxim Spivak <maxims@peru.lbl.gov>:
> 1. I've been using the ^A^A macro. When I call it, it seems to kill the 
> unselected articles and display the selected ones. However, when I 
> reenter the group several days later, the replies to the 
> previously-killed articles are back!  

It is quite possible that you are using trn 3.4.1, overview files, and
not specifying the -a option -- in this case trn had a bug that would
not properly kill all associated threads.  To fix this, grab trn 3.5
from uunet (ftp.uu.net:networking/news/readers/trn/trn-3.5.tar.gz).

> However, after reading the kill-file FAQ, I got the impression that each 
> thread should end with `Tj', not 'TJ'. Is this the problem?

No, the kill file is fine.

As for the macro, I know of no macro documents.  However, it is not too
hard to get a handle on the basics.  Here's the ^A^A macro:

  ^A^A   %(%m=t?%(%Z=^0?::M^J)/\^/\:Tj^J%(%Z%M=^00?q:Y\^):)

%( ? : )  is the if-then-else-endif operator. Knowing this, it is possible
to break it up into indented code:

  %( %m=t ?                 if mode contains 't' then
      %( %Z=^0 ?                if selected-count starts with 0 then
          <NULL-STRING>             do nothing
      :                         else
          :M^J                      run 'M' on all selected articles
      )                         endif
      /\^/\:Tj^J                select all articles and thread-kill them
      %( %Z%M=^00 ?             if selected-count+returning-count == 00 then
          q                         quit group
      :                         else
          Y\^                       yank back the articles and go to top
      )                         endif
  :                         else
      <NULL-STRING>             do nothing
  )                         endif

Notes:

The mode (%m) is a one-character long variable that equals 't' if
you're in the selector.

The '=' operator does a regex match of a variable, so if you're matching
a multi-character variable you might need to anchor your regex (like using
"^0" to match a zero only at the start of the string).

The 'M' command marks articles as read-but-returning.  When used with the
':' command it marks all selected articles, and requires you to press
return -- ^J is two characters that get turned into an ASCII newline.

The command /^/:Tj thread kills all articles (all articles have a beginning
of the subject line, so the /^/ search matches them all).  The '^' and the
':' need to be escaped with backslashes since the former might get mistaken
for a Ctrl-character modifier and the latter would get mistaken for the else
portion of the %(?:) sequence since we're not yet in the else portion.

The two variables %Z%M can only equal "^00" if they are both zero.  Having
them next to each other like they are simply concatenates them into the
one test instead of having to check them separately.

The 'Y' command in the selector yanks back all articles marked with 'M'.

The '^' command in the selector goes to the first page of the selector.
It must be escaped with a '\' to avoid having it modify the ')'.

NOTE that when you type Ctrl-A, Ctrl-A that the WHOLE string gets
interpreted and pushed into the keyboard buffer.  That's why the %Z%M bit
is required above -- we want it to yank back any articles that we pushed
via ":M" (%Z) or any that were already pushed (%M).  In other words, the
various tests in the string don't occur at the time they are popped
from the buffer via read statements, but at the time they are pushed
via macro substitution, so make all your tests reflect the conditions
that were present before the macro started twiddling things.

Finally, it is possible to use "^(STRING^)" to input STRINGs that get
macro expanded as they are input (normally macro-expanded strings are
involatile).  Thus the macros:

q   %(%m=t?+:q)

doesn't loop re-expanding the 'q', but:

q   %(%m=t?+:^(q^))

would overflow the input buffer and generate an error.

It would probably be a good idea to turn info such as this into a
macro FAQ -- any takers?
-- 
Wayne Davison
davison@borland.com
Re: Problems with trn macros (used to be 6 questions)
#9668
Author: Bob Weissman
Date: Thu, 23 Jun 1994 16:58
29 lines
2017 bytes
In article <CrtEAv.HK3@borland.com>, Wayne Davison <davison@borland.com> wrote:
-
-  ^A^A   %(%m=t?%(%Z=^0?::M^J)/\^/\:Tj^J%(%Z%M=^00?q:Y\^):)
-
-%( ? : )  is the if-then-else-endif operator. Knowing this, it is possible
-to break it up into indented code:
-
-  %( %m=t ?                 if mode contains 't' then
-      %( %Z=^0 ?                if selected-count starts with 0 then
-          <NULL-STRING>             do nothing
-      :                         else
-          :M^J                      run 'M' on all selected articles
-      )                         endif
-      /\^/\:Tj^J                select all articles and thread-kill them
-      %( %Z%M=^00 ?             if selected-count+returning-count == 00 then
-          q                         quit group
-      :                         else
-          Y\^                       yank back the articles and go to top
-      )                         endif
-  :                         else
-      <NULL-STRING>             do nothing
-  )                         endif

Eeeyech!

I gave up TECO programming a couple decades ago, but here it
is again, in another form, to haunt me.

This has got to be the ugliest thing I've ever seen.
Re: Problems with trn macros (used to be 6 questions)
#9684
Author: Larry W. Virden
Date: Fri, 24 Jun 1994 14:39
7 lines
1361 bytes
the macro language is complements of Larry Wall, who went on to such
heights of glory as Perl - perhaps it is the descendant of TECO ?
-- 
:s Great net resources sought...
:s Larry W. Virden                 INET: lvirden@cas.org
:s Personal: 674 Falls Place,   Reynoldsburg, OH 43068-1614
The task of an educator should be to irrigate the desert not clear the forest.
Re: Problems with trn macros (used to be 6 questions)
#9707
Author: Larry Wall
Date: Sun, 26 Jun 1994 06:07
8 lines
922 bytes
In article <CrtEAv.HK3@borland.com> davison@borland.com (Wayne Davison) writes:
: As for the macro, I know of no macro documents.

I presume you mean a doc about these specific macros.  The macro language
itself is documented in the rn manpage.

Larry Wall
lwall@netlabs.com
Re: Problems with trn macros (used to be 6 questions)
#9705
Author: Larry Wall
Date: Sun, 26 Jun 1994 06:25
21 lines
1606 bytes
In article <982@eiffel.UUCP> bobw@procase.com writes:
: Eeeyech!
: 
: I gave up TECO programming a couple decades ago, but here it
: is again, in another form, to haunt me.
: 
: This has got to be the ugliest thing I've ever seen.

Yes, and for similar reasons.  rn originally ran on a PDP-11.  It had
to be possible to interpret swatches of input very quickly with a
minimum of memory use.  This drove the need for a rather TECO-like
interpreter.  A further complication is that it's a character-oriented
interpolation language--the default program merely produces itself, in
the absence of some escape character.  I will admit that the choice of
% as an escape character adds to the visual clutter.  Blame printf()...

Nowadays you'd call it byte code and think you were seeing something cool,
if you thought a computer wrote it.  :-)

Larry Wall
lwall@netlabs.com
Re: Problems with trn macros (used to be 6 questions)
#9708
Author: Wayne Davison
Date: Sun, 26 Jun 1994 08:57
14 lines
1173 bytes
I said:
> As for the macro, I know of no macro documents.

Larry Wall <lwall@netlabs.com> said:
> I presume you mean a doc about these specific macros.  The macro language
> itself is documented in the rn manpage.

No, I meant to say no additional macro documents -- the original poster
was asking for tutorial documents because the manpage for trn (and rn)
outline the basics of macros, but don't delve into any really complicated
examples.
-- 
Wayne Davison
davison@borland.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads