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

RE: [jasspa] by the way tags

Expand Messages
  • Phillips, Steven
    Try using a command variable such as .push-position.stack e.g. define-macro push-position !if &les .push-position.stack 255 set-position &itoa &pinc
    Message 1 of 3 , Jan 16, 2006
    • 0 Attachment
      Try using a command variable such as '.push-position.stack' e.g.

      define-macro push-position
      !if &les .push-position.stack 255
      set-position &itoa &pinc .push-position.stack 1
      !else
      ml-write "Tag stack full!"
      !endif
      !emacro

      define-macro pop-position
      !if &gre .push-position.stack 240
      goto-position &itoa &dec .push-position.stack 1
      !else
      ml-write "Tag stack empty!"
      !endif
      !emacro

      set-variable .push-position.stack 240

      > -----Original Message-----
      > From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf
      Of
      > Deak, Ferenc
      > Sent: Monday, January 16, 2006 11:12 AM
      > To: jasspa@yahoogroups.com
      > Subject: [jasspa] by the way tags
      >
      > Hi!
      >
      > If we are talking about tags, I have a macros/mappings to create a tag
      > stack a-la vim.
      > It means when I call find-tag the previous position is pushed into a
      stack
      > (length of 16), and
      > I can pop these positions to get back to the place where I called
      find-tag.
      > I think is is very useful
      > for programming.
      >
      > It use global variables, so it is not too nice. Is there any way to
      > implement it better?
      >
      > set-variable %tag-stack 240
      >
      > define-macro push-position
      > !if &les %tag-stack 255
      > set-position &itoa &pinc %tag-stack 1
      > !else
      > ml-write "Tag stack full!"
      > !endif
      > !emacro
      >
      > define-macro pop-position
      > !if &gre %tag-stack 240
      > goto-position &itoa &dec %tag-stack 1
      > !else
      > ml-write "Tag stack empty!"
      > !endif
      > !emacro
      >
      > define-macro tag-find
      > push-position
      > 0 find-tag
      > !if ¬ $status
      > pop-position
      > !endif
      > !emacro
      >
      > define-macro tag-pop
      > pop-position
      > !emacro
      >
      >
      >
      >
      ________________________________________________________________________
      __
      >
      > This is an unmoderated list. JASSPA is not responsible for the content
      of
      > any material posted to this list.
      >
      > To unsubscribe, send a mail message to
      >
      > mailto:jasspa-unsubscribe@yahoogroups.com
      >
      > or visit http://groups.yahoo.com/group/jasspa and
      > modify your account settings manually.
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
    • Deak, Ferenc
      My problem is not the global %tag-stack variable, but the usage of set-position where I use global postions from 240 to 255. It would be better to create a
      Message 2 of 3 , Jan 16, 2006
      • 0 Attachment
        My problem is not the global %tag-stack variable, but the usage of
        set-position where I use global postions from 240 to 255.
        It would be better to create a real stack abstraction from a list.
        Is there something similar in Jasspa macros?

        On Mon, 16 Jan 2006 06:31:51 -0500
        "Phillips, Steven" <sphillips@...> wrote:

        > Try using a command variable such as '.push-position.stack' e.g.
        >
        > define-macro push-position
        > !if &les .push-position.stack 255
        > set-position &itoa &pinc .push-position.stack 1
        > !else
        > ml-write "Tag stack full!"
        > !endif
        > !emacro
        >
        > define-macro pop-position
        > !if &gre .push-position.stack 240
        > goto-position &itoa &dec .push-position.stack 1
        > !else
        > ml-write "Tag stack empty!"
        > !endif
        > !emacro
        >
        > set-variable .push-position.stack 240
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.