x-lang

apps/bitwise — Bitwise, the owl sigil, drawn for a project

    ., .,
    {O,O}
    (   )
     " "

Bitwise is the owl stamped in the header of every x source file. This app keeps it exactly that: the glyphs, set from Roboto Mono’s outlines so it is the same owl on every machine. The project’s name decides everything around it: sha256(name) seeds a bitwise function over a cell grid for the owl to sit on, and the accent hue. A project with a mascot, a logo colour or an idiom of its own wears it as a costume. Same name, same picture, forever.

x -l bitwise -- --all --png                  # every project under ../, three formats each
x -l bitwise -- x-awk                        # the mark, SVG on stdout
x -l bitwise -- x-awk --fmt banner --tagline "POSIX awk on x-lang" --kind "a language on x-lang" -o x-awk.svg --png
x -l bitwise -- x-awk --json                 # the seeded parameters

Formats: mark (owl over its field, square, transparent ground, viewBox 100×100), avatar (512×512 on paper, for a repo or org avatar), banner (1280×640 with name, tagline, reference line and the field formula, the GitHub social-preview size). --all discovers x-expr, x-lang, engines/* and languages/* under --root (default .., the x workspace when run from this checkout), reads each tagline from the first paragraph of its README, and writes into --out (default build/bitwise) plus an index.json. --png shells out to rsvg-convert when it is on PATH.

Files

file what
run.x the entry: boots the core, arms the roots, runs the command line
gen.x class Bitwise: seeding, field, palette, costume, the owl, the formats; (Bitwise render name fmt tagline kind uid), (Bitwise params name), (Bitwise diff a b)
cli.x class BitwiseCli: arguments, workspace discovery, README taglines, files and PNGs; (BitwiseCli main args)
glyphs.xon printable ASCII, λ and ▲ as outlines from Roboto Mono Regular (Apache-2.0); ▲ borrowed from Menlo
gallery/bitwise.js the browser twin: the same integer geometry, byte-identical output
gallery/gallery.tmpl.html, gallery/build.js the live page: node apps/bitwise/gallery/build.jsbuild/bitwise/gallery.html
gallery/parity.js renders the twin’s side of the parity set, from the same frozen costumes the specs load

The project files this app reads live in the projects: each repository carries bitwise.xon at its root. Each file here is one class and one public global, every helper a %-static on it (the tree’s rule for %-globals); the data root is armed with (Bitwise root! dir), by the entry from %install-root and by a spec as apps/bitwise.

How a picture is made

Every quantity is an integer. Geometry is carried in micro-units and formatted half-up to one, two or four decimals, so the picture is a function of the name alone and the twin computes the identical bytes with the same integer arithmetic. The first ten digest bytes settle the traits:

digest bytes trait
0–1 hue of the accent, to a tenth of a degree
2 operator: xor · and · or · rings · moire · prod
3 which bit of the result is sampled (1–4)
4, 5 odd multipliers a, b (1–15)
6, 7 field offset (0–31 cells)
8 salt xor’d into the field
9 grid resolution: 16 · 20 · 24 · 32

Cell (x, y) is lit when the chosen bit of f(x, y) is set. A near-empty or near-solid field (under 18% or over 82% lit) advances the bit, then the operator, deterministically, until the field reads as a texture. The owl itself is never generated.

Costumes

A costume belongs to its project. Each repository carries bitwise.xon at its root holding its own (costume "NAME" ...) form; discovery hands every one it finds to (Bitwise costume-load! path), and a name with no costume registered wears the plain owl. --all also writes the gathered forms as costumes.xon beside the pictures, which is what the gallery build inlines for the browser twin. Every field is optional:

(costume "x-python"
  (mascot "the two Python snakes")        shown on the gallery card and in the readout
  (logo "Python blue and yellow")         printed where the hue would be
  (accent 207 51 44)                      h s l: replaces the hashed hue in the field and the eyes
  (secondary 45 100 42)                   the colour for role b
  (eyes (207 51 44) (45 100 42))          two-tone eyes, left then right
  (rows "., .," "{O,O}" "( py)" " \" \"")  the owl's glyph rows in costume: printable ASCII, λ or ▲
  (roles "ii ii" "ieifi" "i aai" " i i ") same shape: i ink, e/f the eyes, a accent, b secondary
  (reference "print(\"{O,O}\")"))         one line in the project's own language, on the banner

Bitwise’s nose is a comma, {O,O}; only the auk keeps its > bill, for the wordplay. A costumed owl carries its logo on its belly: ( C ) for the C compiler, ( λ ) for the Schemes, ({+}) for sweet-expressions, (/./) for grep, (krn) for Kernel, ( py) for Python, ( ▲ ) for Logo, (awk), (sed), (all), ( | ), ( $ ). x-lang, x-expr and the C engine keep a plain belly. The Rust engine is Ferris: {O,O} over V V.

Changing the design

gen.x is the definition; gallery/bitwise.js follows it. After a change to either, regenerate the digests both must answer and put them in the parity spec:

node apps/bitwise/gallery/parity.js

Never edit a rendered SVG by hand; change the generator and re-render. A project renames, its field changes, and that is the point. The owl does not change, ever.

glyphs.xon was extracted once from RobotoMono-Regular.ttf with a fontTools one-off (kept outside the tree, beside the font); a wider glyph set is a re-extraction, not an edit.