{{{  comments
; This package uses the package oripager to show a file in the areawindow
; In addition to this, you can move a pointer through this file and invoke
; actions for the choosen line. Therefor the command
;   oricmd <b> <l> <o>
; is called.
; Arguments are
;   b current blocknumber
;   l length of block
;   o current line in the block
; For example, you can use the command oripager to do something.
;   oripager -b<b> -l<l> -o<o> | myprogram
; you can also use your own macros, the data for the parameters is stored in
;   b area-position
;   l area-length
;   p menu-position
}}}
@if-using not(OPM)
  @use (OPM)
  {{{  libs
  {{{F fun/oripager
  :::F fun/oripager
  }}}
  }}}
  {{{  vars
  ( defvar
     ( menu-position ; current line in menu
       menu-x        ; dummy to show on x-position 1
     )
  )
  }}}
  {{{  menu-start
  ( deffun menu-start
     (
       {{{  start the area-display
       set-counter area-length 10
       set-counter area-lead 1
       pager-start
       }}}
       {{{  write the pointer
       set-counter menu-x 1
       set-counter menu-position 1
       write-area menu-x menu-position ">
       }}}
     )
  )
  }}}
  {{{  menu-next-page
  ( deffun menu-next-page
     ( if counter>0 menu-position
        (
          {{{  next menu-page
          pager-next
          set-counter menu-position 1
          }}}
          write-area menu-x menu-position ">
        )
       else
        ( pager-next )
       fi
     )
  )
  }}}
  {{{  menu-next
  ( deffun menu-next
     ( if counter>0 menu-position
        {{{  handle menuline
        ( write-area menu-x menu-position "  ;
          set-counter menu-position +(menu-position 1)
          if counter-0 -(menu-position area-length)
           {{{  next menu-page
           ( pager-next
             set-counter menu-position 1
           )
           }}}
          fi
          write-area menu-x menu-position ">
        )
        }}}
       else
        ( menu-next-page )
       fi
     )
  )
  }}}
  {{{  menu-previous-page
  ( deffun menu-previous-page
     ( if counter>0 menu-position
        (
          {{{  get previous page
          pager-previous
          set-counter menu-position +(area-length -1)
          }}}
          write-area menu-x menu-position ">
        )
       else
        ( pager-previous )
       fi
     )
  )
  }}}
  {{{  menu-previous
  ( deffun menu-previous
     ( if counter>0 menu-position
        {{{  handle menuline
        (
          write-area menu-x menu-position "  ;
          set-counter menu-position +(menu-position -1)
          if counter-0 menu-position
           {{{  get previous page
           ( pager-previous
             set-counter menu-position +(area-length -1)
           )
           }}}
          fi
          write-area menu-x menu-position ">
        )
        }}}
       else
        ( menu-previous-page )
       fi
     )
  )
  }}}
  {{{  menu-again
  ( deffun menu-again
     ( pager-again
       if counter>0 menu-position ( write-area menu-x menu-position "> ) fi
     )
  )
  }}}
  {{{  menu-end
  ( deffun menu-end
     ( set-counter menu-position 0
       pager-end
     )
  )
  }}}
  {{{  menu-call
  ( deffun menu-call
     ( if counter>0 menu-position
        {{{  call the std-command
        ( shell-command
            "oricmd "  counter area-position
                    "  counter area-length
                    "  counter menu-position
          newline-and-indent
          newline-and-indent
        )
        }}}
       else
        ( menu-start )
       fi
     )
  )
  }}}
@fi
