Skip to content

0.12

Latest

Choose a tag to compare

@dd86k dd86k released this 30 Aug 17:54
· 6 commits to master since this release

Prompt and prefix overhauls, readline enhancements, diff pane navigation, write protection overhaul, terminal rendering fixes, and new prefixes.

I'd like to nickname this release "from toy to tool".

Warning

This release removes unpredictable variable-size prefixes and adds new comprehensable fixed-size prefixes. The x: prefix was repurposed as an array type instead of a variable-sized scalar type. See x8:/x16:/x32:/x64: instead.

Warning

s: prefix was removed for ambuguity, use utf8: instead, which is how ddhx natively interfaces with the system anyway.

Warning

Under the new quote mechanic, all strings are raw, except for double-quotes (""), which now allow for escapes (i.e., \xff, \t, \\ as one backslash, etc.). Single-quotes ('') are used to contain spaces while still remaining raw strings.

Overview

  • Command line overhaul: Now with C string expressions.
    Arguments are split with single quotes (raw) and double quotes (C string literals with escape sequences), for every command and in configuration files, not just for patterns.
    WARNING: s: and "string" prefixes are gone, so find s:test and find "test" are now errors; use find utf8:test or find utf8:"test" instead.
  • Pattern prefix overhaul: Fixed-width prefixes without surprises.
    The variable-width scalars (d:, o:, and 0o), which produced needles of odd lengths depending on the value written. They are now replaced by fixed-width ones: u8/u16/u32/u64, i8/i16/i32/i64, x8/x16/x32/x64, and o8/o16/o32/o64. The x: prefix is now a byte string, so x:1122 produces [ 11, 22 ] in order.
  • New text patterns: utf8:, utf16:, and utf32:
    These transcode text from UTF-8 (the readline implementation).
  • New float pattern prefixes: f32:, f64:, and f80: (x87 extended) and constants: f32:pi, u16:max, etc.
  • Diff mode navigation: new diff-next / diff-prev commands (bound to } and {) jump between differing regions with a diff panel opened, with a cursor mirror and better alignment in the diff panel.
  • Write protection overhaul: new -W/--writable flag and writemode config; write mode is now enforced on fixed-size media.

Added

  • Single quoting ('TEXT', raw) and double quoting ("TEXT", C string literal)
    for command arguments (decc3ee)
  • C escape sequences inside double quotes: \a \b \e \f \n \r \t \v \\ \' \" \?, octal (\0, \377), and hexadecimal (\x1b) (decc3ee)
  • Fixed-width pattern prefixes: x8:/x16:/x32:/x64:, u8:..u64:, o8:..o64:, and signed i8:..i64:. A value too large for its width is an error rather than a truncation
  • Signed pattern values, encoded as two's complement: find i16:-1. Only the i* prefixes take a sign; a minus on an unsigned type is reported rather than wrapped
  • Text pattern prefixes utf8:, utf16: and utf32:, alongside utf8:. Takes from endian setting. No BOM is emitted.
  • Float pattern prefixes f32: and f64:, always binary32 and binary64 on every platform.
  • Float pattern prefix f80: for x87's 80-bit extended (long double): ten bytes.
  • nan/qnan, snan, snan_hi, indefinite, pi, e, tau, sqrt2, phi constants and max, min, epsilon, denorm_min properties for the float prefixes, each at the width's
    precision: 'f80:pi' is the ten bytes FLDPI loads.
  • max and min properties for the integer prefixes.
  • find-bookmark command: bookmarks every match of a pattern in one pass. (a0bb40f)
  • find-bookmark-limit config option: how many matches find-bookmark takes before it stops and says so. Defaults to 4096. (f8f8544)
  • -W/--writable flag. (cb1c02d)
  • writemode config option, enforced on fixed-size media. (6fd3d7e)
  • diff-next / diff-prev commands mapped to } / {. (73a5983)
  • Cursor mirror in the diff panel. (e77bd04)
  • Braces and Pipe terminal enum values. (7d15f8b)
  • show command with name, path, size, and version arguments. (e7f786e)
    Easier to remember than report command.
  • Add statusbar format optional argument to report command.

Changed

  • Quoting and escapes apply to every command and to configuration files, not only to patterns: save-as "dump\x2Etxt" saves dump.txt (decc3ee)
  • Arguments are bytes rather than text, so an escape may produce data that is not valid UTF-8. Commands that need text (save-as "\xff") report it, and commands that take data are unaffected (decc3ee)
  • Unquoted and single quoted text is raw, so a path needs no escaping: find utf8:C:\Users and diff-file C:\dump.bin work as typed (decc3ee)
  • An unknown escape, an unterminated quote, and a hex escape with a third digit are errors instead of being guessed at (decc3ee)
  • x: and 0x are byte strings rather than integers, so digits are taken in the order written and the length is no longer capped at 64 bits. An odd number of digits is an error instead of being padded: x:0 is now x:00
  • The s: string pattern prefix is now utf8:, since a text prefix names the encoding its bytes come out in the same way a scalar prefix names its width.
  • The endian setting (and Alt+E) now applies to scalar patterns as well as to the inspector, instead of scalars silently using the host`s endianness
  • Scalar patterns always state a width, so a pattern's length no longer depends on the value written in it. d:255 becomes u8:255 or u16:255, o:377 becomes o8:377. Variable-length prefixes sometimes created 3, 5, or 7-byte needles which made a lot of aligned operations pretty confusing.
  • Restricted mode split into its own variable, simplifying -W handling (0ae096e)
  • Diff panel alignment improved (391a387)
  • Benchmark tool: fixed compile, uses default editor when run without args (3ffdac4)

Fixed

  • Backward search never tested offset 0, so a needle sitting at the very start of the document was unfindable with find-back
  • Patterns no longer silently accept trailing garbage: x16:12zz was taken for 0x12, and is now an error.
  • Row drift when lines are truncated by terminal width (4bcb010)
  • Terminal partial rendering for readline (63cdbf7), with multiple fixes:
    • cell count no longer relies on terminalWrite, counts using graphs
      instead
    • text truncated correctly according to terminal size
    • scroll condition no longer ignores base position
    • CJK width heuristic no longer fails to fire (byte vs char comparison
      bug)

Removed

  • Bare "STRING" pattern alias for utf8:STRING. Quotes are the prompt's syntax, not a pattern type, so the utf8: prefix is always required (decc3ee)
  • Bare d:, o:, and 0o pattern prefixes. They named a type without a size, so they are gone rather than defaulted, and are now unknown prefixes. Decimal is u8:..u64: and i8:..i64:; octal is o8:..o64:. 0x is unaffected, being a byte string like the x: it abbreviates

Docs

  • ddhx.1 manpage updated for writemode, -W, and diff-next/diff-prev (6fd3d7e, 0ae096e, cb1c02d, 73a5983)
  • ddhx.1: new Quoting subsection under COMMANDS, rewritten utf8: and wildcard entries under PATTERNS (2f06c99)
  • src/README: new COMMAND LINE section covering the rules, the cases the design is pinned to, and why each decision was made (aa9d503)
  • src/README: PREFIXES subsection on the byte string versus scalar split, plus the rationale for widths, for endianness being a setting, and for x: no longer being a number
  • ddhx.1: PATTERNS rewritten for the width prefixes, and the endian setting no longer described as inspector-only