From 65612a1cc13dd2a7e866f88176dbf6db5dd83467 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 00:41:40 -0300 Subject: plumber: Plan 9's plumber in the core, its language and its files (docs/next-plumber.md, phase 1): src/Plumb.zig owns the rules, kept as their text (Core.plumber, digested and dumped; `include basic`'s, the embedded src/plumbing, until any are written, so a session and a dump from before it start with the defaults) and parsed again for each message, and a matcher over them read from rules.c and match.c: the message's pack and unpack (plumbunpackpartial's whole, short of its data, malformed), packed attributes read and quoted rc's way, rule sets of `object verb arg` lines, variables, include (basic, the configuration directory's, an absolute path, through the taped read site), rc's quoting and `$` expansion at parse and at match, every parse refusal in rules.c's words with its file and line, `$1`-`$9` refused in words (the regular expressions have no capture groups), `matches` over regexp.zig whole (`^(...)$`) or around a click counted in runes with Pike's two patterns, `is`, `set` rewriting for good, `add`, `delete` failing on an attribute not there as match.c's code does, `isfile` and `isdir` finding a name as Look does (past its place, the message's directory, a look's jump list's, Incl's) at the taped resolve sites, once a send; dispose to a port pardes reads (edit: opened as a look opens it, at addr=; web: the host's link opener; a loaded kind by its name), to a rule set's start or client run as exec runs a line (a builtin in place, else a command pane in the message's wdir: Core.exec_dir, exec.runCommand's reuse skipping the sender), or Plan 9's words for what went nowhere; rules print back in the order they were written, a variable where it was set, so a printed text reads back the same; plumb/rules (a write adds rule sets as each is whole, the rest at the close, `>` replaces them, one writer at a time) and plumb/send (a message put together across writes) in the tree, with fs-help's line, the reference's section and tree, and the fstree test's paths; nothing calls the plumber from Look yet; test: Plumb.zig's eleven (every parse error, print and read back, plan9port's basic less its submatch rule sets, its ¡-￿ classes UTF-8's bytes, whole and click matches with horse.gift, quoting, a set's rewrite kept, delete of an absent attribute, dst filtering, isfile and isdir, dispose, a dump keeping the rules), test/behaviour/plumber.zig's two through the tree (Session records the link a host would open); the root's listings in tree.zig's and the process tests gain plumb, and the README folds a blank line to stay 45 lines; the changelog says so MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- docs/typ/reference.typ | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'docs/typ') diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 7360179f..d0fdd1dd 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -38,6 +38,9 @@ addons the kinds of pane here, compiled in or an addon's @add layout a line per column, then active @columns-and-tags tag the workspace tag @columns-and-tags tagexec a word clicked in the workspace tag @columns-and-tags +plumb/ the plumber's: plumb(6) rules, and messages sent by them @plumber + rules the rules in force; a write adds rule sets, > replaces them @plumber + send write a message: six header lines, then its data @plumber col/ the columns @columns-and-tags / column ; rmdir closes it when empty @columns-and-tags tag its tag @@ -1015,6 +1018,51 @@ at 200, ending in `…`. Control characters become spaces. synthetic. Linux v9fs's truncation `mtime` hint is accepted and dropped. - #file("/src/") with `-Dembed-sources=true`. += The plumber + +Plan 9's plumber(4), its language plumb(6)'s, in the session: rules +match a message and say where it goes. A #word("Look") does not ask it +yet (the #word("Plumb") rules do, #doc("reference", section: "from-acme")). + +- #file("/plumb/rules") reads the rules in force: rule sets of + `objectverbarg` lines, each set ended by a blank line, a + variable's `name=value` where it was set, an `include`'s rules in its + place. A session starts with `include basic`, pardes's own + (`src/plumbing`): a URL to the `web` port, an existing directory or file + (at the place written after it) to `edit`. A write adds rule sets, each + read as its blank line comes, the rest at the close; `>` replaces them + all. One open writes at a time (`file in use`). Kept in a dump. +- A rule set that does not read is refused at the write it is whole in, + `plumb/rules:: ` in rules.c's words (`unknown verb isnt`, + `ruleset must have patterns and actions`), and the rules stay as they + were. `$1`-`$9` are refused: pardes's regular expressions + (#doc("reference", section: "regexp")) have no submatches; write `$0` + and several `matches`, as Pike's two patterns do. `include basic` is + `src/plumbing`; another name is the configuration directory's file, an + absolute one where it says. +- #file("/plumb/send") takes a message, plumb(6)'s six lines (`src`, + `dst`, `wdir`, `type`, `attr`, the data's length) and then the data, + in one write or several. The write is answered once it has gone where + the first rule set whose patterns hold says, or refused in Plan 9's + words: `bad plumb message format`, `couldn't find destination for + message` (no rule set takes it and it names no port), `no start action + for plumb message`, `no port for "client" rule`. +- The verbs are plumb(6)'s: `is`, `matches` (the whole text; with + `click=N` in `attr`, the run around rune N, and the data cut to it), + `isfile` and `isdir` (a name found as #word("Look") finds one: past the + place written after it, in `wdir`, then #word("Incl")'s directories; + `$file` and `$dir` are where), `set`, `add` and `delete` (`delete` of + an attribute not there fails, as plumber's code does), and the actions + `plumb to `, `plumb start ` and `plumb client `. +- The ports pardes reads itself: `edit` (the data opened as a + #word("Look") opens it, at `addr=` when given), `web` (the host's + browser, a URL of at most 256 bytes) and each loaded kind by its name + (`image`, `pdf`). A message to another port runs its rule set's + `start` or `client`; to a port no rule names it goes nowhere. +- `plumb start` runs its words as #word("Exec") runs a line: a builtin in + place at the pane with the keyboard, anything else a command pane in + the message's `wdir`, each word one argument to the shell. + = Addons An addon is a shared library that brings one kind of pane: a picture, a -- cgit v1.3