mhonarc-users

Re: patch: improved TSLICE, thread navigation, ...

2001-07-04 00:35:19
Behaviorial-wise, I aggree with you on how TNEXT and TPREV should behave
for TREVERSE.

Awesome! :)

may make things *faster* overall (particularly for LINKs). The extra
...

From a quick look at the code you sent, your cache attempt does not
appear to work since you reset it each time replace_li_var() is called
(losing what you cached).  The cache structure must exist outside of
replace_li_var(), and be reset when a new archive is opened.  I could
be wrong with this assessment since it is based on looking at the
patch data itself.

My intention was a sort of local cache, that would last only across
*nested* calls to replace_li_var. That's why LINKs would be most improved;
if I understand it right, they expand to a bunch of related variables.

But you are right, my intentions failed. One fix is pretty simple: add
another argument to replace_li_var. A patch, which should be applied *on
top of my previous patches*, is attached.

Even better would be to replace calls like this:

         ($tmpl = $SUBJECTEND) =~ s/$VarExp/&replace_li_var($1,$index)/geo;

with something like this:

         $tmpl = &replace_li_vars($SUBJECTEND, $index);

where the &replace_li_vars() function would maintain the cache between
calls to &replace_li_var(). I will make this change in my local copy, and
will send it along if you'd like.

love,ed

*** /u/eddietwo/mhrcvars.pl     Tue Jul  3 22:04:36 2001
--- MHonArc2.4.9-p/lib/mhrcvars.pl      Tue Jul  3 21:56:57 2001
***************
*** 81,87 ****
  ##    calling routine or as globals.
  ##
  sub replace_li_var {
!     my($val, $index) = ($_[0], $_[1]);
      my($var,$len,$canclip,$raw,$isurl,$tmp,$ret) = ('',0,0,0,0,'','');
      my($jstr) = (0);
      my($expand) = (0);
--- 81,87 ----
  ##    calling routine or as globals.
  ##
  sub replace_li_var {
!     my($val, $index, $poscache) = ($_[0], $_[1], $_[2]);
      my($var,$len,$canclip,$raw,$isurl,$tmp,$ret) = ('',0,0,0,0,'','');
      my($jstr) = (0);
      my($expand) = (0);
***************
*** 90,97 ****
      my($arg, $opt) = ("", "");
  
      ##        Cache compute_msg_pos results
!     my($poscache) = { };
!     $poscache->{'$CURINDEX'} = $index;
  
      ##        Get variable argument string
      if ($val =~ s/\(([^()]*)\)//) {
--- 90,96 ----
      my($arg, $opt) = ("", "");
  
      ##        Cache compute_msg_pos results
!     $poscache = { '$CURINDEX' => $index } if !defined($poscache);
  
      ##        Get variable argument string
      if ($val =~ s/\(([^()]*)\)//) {
***************
*** 576,582 ****
  
      ##        Check if string needs to be expanded again
      if ($expand) {
!       $tmp =~ s/$VarExp/&replace_li_var($1,$index)/geo;
      }
  
      ##        Check if URL text specifier is set
--- 575,581 ----
  
      ##        Check if string needs to be expanded again
      if ($expand) {
!       $tmp =~ s/$VarExp/&replace_li_var($1,$index,$poscache)/geo;
      }
  
      ##        Check if URL text specifier is set
<Prev in Thread] Current Thread [Next in Thread>