Loading ...
Sorry, an error occurred while loading the content.

38877Re: New snapshot 7.0046

Expand Messages
  • Bram Moolenaar
    Feb 1, 2005
      Johnny Blaze wrote:

      > On Mon, 31 Jan 2005 23:08:57 +0100, Bram Moolenaar <Bram@...> wrote:
      > >
      > > I just sent out a new snapshot. Several problems were fixed.
      > >
      > > New feature: variable locking.
      > >
      > > :lockvar {name} locks a variable
      > > :unlockvar {name} unlocks a variable
      > > islocked() checks if a variable or value is locked.
      >
      > Bram,
      >
      > There is something hinky going on with the locking. I'll paraphrase
      > the script I'm working with:

      It's possible that there are still a few places where the lock flag
      isn't initialized properly. It's hard to find all the spots.

      > let s:dirty = { 'file': 0, 'menu': 0 }
      >
      > fun Read()
      > let s:dirty.menu = 1
      > endfun
      >
      > fun CheckState()
      > if s:dirty.menu
      > let s:dirty.menu = 0
      > end if

      "end if" -> "endif".

      > endfun
      >
      > call Read()
      > call CheckState()
      >
      > At 'call Read()' islocked("s:dirty") == 0 and islocked("s:dirty.menu") == 0
      > At 'call CheckState()' islocked("s:dirty") == 0 and
      > islocked("s:dirty.menu") == 1

      Not for me. Must be a missing initialisation. Try this change:

      *** eval.c~ Mon Jan 31 17:56:07 2005
      --- eval.c Tue Feb 1 10:27:42 2005
      ***************
      *** 2211,2216 ****
      --- 2211,2217 ----
      else
      {
      *lp->ll_tv = *rettv;
      + lp->ll_tv->v_lock = 0;
      init_tv(rettv);
      }
      }

      > if I am stepping through the script and before "let s:dirty.menu = 0"
      > in CheckState() I execute :unlockvar s:dirty.menu, I get "E742: Cannot
      > change value of s:dirty.menu = 0"

      That means a flag is set that is used for function arguments. You can't
      reset it with ":unlockvar". Again sounds like missing initialisation.

      --
      A)bort, R)etry, D)o it right this time

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
    • Show all 5 messages in this topic