Download Latest Version q-56.tar.gz (234.4 kB)
Email in envelope

Get an email when there's a new version of q

Home / v56
Name Modified Size InfoDownloads / Week
Parent folder
q-56.tar.gz 2020-11-21 234.4 kB
README.md 2020-11-21 2.0 kB
Totals: 2 Items   236.3 kB 0

Two major innovations:

  • Q can search for and replace a regular expression (RE). Assert fm+g to enable this feature. Once asserted, Locate and Ychangeall will treat their first argument as an RE and accept an additional argument being the sub-expression (SE) index: 1 for the entire RE or 2 for the first SE and so on.
  • A macro can pop a new q interactive command level to deal with a situation with which it cannot cope. This works even if q is running in a pipe, as long as it was started from or has some association with a tty. The macro issues an FReprompt command (only available from within a macro) to get the q prompt. The user makes whatever changes are required then inssues the quit command to continue the macro. Or, she can issue the fquit command to abandon the calling macro and go back to the base-level q prompt.

Completed a number of TODO items: see the DONE file for a complete list. Perhaps of some note:

  • Delete is faster now it no longer reads every line as if it were Modify. A casual test on a 3.6GHz system using the time internal bash command showed time to delete 100000000 (100M) lines went from 20.7 sec down to 4.3 sec. A more rigorous investigation (using the new PSCLOCK opcode listed below) showed q spent most of the shorter time mapping where lines started (in the memory-mapped file) and Delete of any number of lines took approximately 6 microseconds compared with over 15 seconds for 100M lines previously.

New ALU opcodes since version 55:

  • PSHWDTH Push screen width to R
  • PSHHGHT Push screen height to R
  • PSVBINT Push Visible Bell Interval to F
  • PPVBINT Pop F to Visible Bell Interval
  • PSFBINT Push Fbrief Interval to F
  • PPFBINT Pop F to Fbrief Interval
  • PSCLOCK Push result from clock(3) to F as seconds
  • TSTFMOD set X = 1 if file modified, else set X = 0
Source: README.md, updated 2020-11-21