Article View: news.software.readers
Article #36601Re: [slrn] Variables in scorefile?
From: Lloyd Zusman
Date: Sun, 12 Oct 1997 00:00
Date: Sun, 12 Oct 1997 00:00
77 lines
4322 bytes
4322 bytes
On 12 Oct 1997 19:38:48 GMT, J.B. Nicholson-Owens <jbn@pop-a-wheelie.midwest.net> wrote:
> Hubert Canon <Hubert.Canon@irisa.fr> wrote:
> > What about using a preprocessor like m4 or cpp ?
>
> I thought about doing this, but it doesn't reflect the dynamic nature of
> variables as well as real variables (or functions) do. I would like to
> change certain newsgroup variable definitions on the fly in S-Lang code. If
> I use pre-processing, I'm left with a static scorefile with the same limits
> of what I've got now. Also, I don't think I want to have to raise the
> resource requirements by a preprocessor (m4, cpp or something else) to do
> what can be done cleanly entirely with S-Lang.
I agree that m4 and the like are not quite sufficient for this
purpose. After reading your initial query, I started to write a
preprocessor in Perl that would serve as a front end to the editor
specified for manipulating the score file ... it would read a skeleton
score file containing variables which you'd edit, and then it would
create from this the real score file with the variables substituted
which slrn would read.
The problem with this (which I didn't figure out until I just about
finished it) is that slrn itself modifies the score file when you try
to edit it via slrn's user interface. Therefore, this entire skeleton-
scorefile-and-preprocessor method falls apart.
I could have hacked around this by saving a "before" and "after"
version of the score file, taking diffs, and then automatically
applying these diffs to the skeleton score file before editing it, but
I decided that this is way too much trouble to go through just to
provide some functionality that slrn could provide itself in a much
more straightforward manner, and in a way that integrates much more
tightly with the slang functionality that's already an integral part
of slrn.
> It's a fine idea for an interim solution, but ultimately I would like real
> S-Lang variables or functions in the scorefile. If there were a way to make
> slrn rescan the scorefile, preprocessing+rescan would be either exactly the
> same or almost the same as variables and functions in the scorefile
> (depending on the where the variables and functions may appear in the
> scorefile and how many times the scorefile would be rescanned to resolve
> functions or variables).
Perhaps a way to do this would be to provide a functional interface to
scoring. In other words, one could replace this ...
[my.newsgroup.1,my.newsgroup.2]
Subject: Make money fast!
score: -9999
... with something like this in a slang script ...
variable field = "Subject";
variable pattern = "Make money fast!";
variable score = -9999;
scoreNewsgroup("my.newsgroup.1", field, pattern, score);
scoreNewsgroup("my.newsgroup.2", field, pattern, score);
A variable in .slrnrc could control whether scores are managed
via the .scores file that is in use today, or via this newer
mechanism involving a slang script. All the features of slang
would be available in this scoring script, and this would
provide even more flexibility and functionality than
what we'd get from scanning and re-scanning the score file
for variable substitutions.
Perhaps most of the infrastructure for something like this is already
in place in slrn ... ???
> [ ... ]
--
Lloyd Zusman
ljz@asfast.com
Technical Details
Message-ID:
<slrn642k1i.fj9.ljz@ljz.asfast.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<slrn63gm05.ad.jbn@pop-a-wheelie.midwest.net> <slrn63gr84.13h.sp_robi@Elvira.home> <slrn63h1ti.ad.jbn@pop-a-wheelie.midwest.net> <slrn63rfmg.bnv.sp_robi@Elvira.home> <slrn63rp0b.411.jbn@pop-a-wheelie.midwest.net> <slrn63sjme.44k.Hubert.Canon@guenievre.irisa.fr> <slrn6429lb.65s.jbn@pop-a-wheelie.midwest.net>Show Full Headers
Complete Article Headers
Message-ID: <slrn642k1i.fj9.ljz@ljz.asfast.net> Subject: Re: [slrn] Variables in scorefile? Date: Sun, 12 Oct 1997 00:00:00 +0000 From: ljz@asfast.com (Lloyd Zusman) References: <slrn63gm05.ad.jbn@pop-a-wheelie.midwest.net> <slrn63gr84.13h.sp_robi@Elvira.home> <slrn63h1ti.ad.jbn@pop-a-wheelie.midwest.net> <slrn63rfmg.bnv.sp_robi@Elvira.home> <slrn63rp0b.411.jbn@pop-a-wheelie.midwest.net> <slrn63sjme.44k.Hubert.Canon@guenievre.irisa.fr> <slrn6429lb.65s.jbn@pop-a-wheelie.midwest.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 279898472 X-Newsgroup: news.software.readers Reply-To: ljz@asfast.com (Lloyd Zusman) Organization: As Fast Newsgroups: news.software.readers