Skip to content

Rolling context buffer for backward context #106

@yoavnir

Description

@yoavnir

Used similar to WRITE:

  • CTXBUF + numeric constant indicating count of backwards lines
  • DUMPCTX - causes an emptying of the buffer
  • SETCTR + numeric constant indicating count of forward lines
  • settablectr() function - decremented with each line. Starts at zero and decreases with every line

Example:

# Print 3 lines before and 5 lines after any line that contains 'marker'
1-* 1
if "includes(@@,'marker')" then
    DUMPCTX # dumps the queue
    SETCTR   5
endif
if "settablectr()<=0" then
    CTXBUF  3  # eats the record into a size-3 queue. Otherwise it gets printed
endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    FutureEnhancement or fix for a future versionenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions