Home/Modules/common-rails

common-rails

library module lib/common-rails

/lib/common-rails — one professional-printing surface for the toolchain

CommonRails is the SLeeLa toolchain's shared output surface. It gives the four output producers — the compiler (Sleelvac), the Nordshrift transpiler, a running program, and the debugger — one aligned, column-formatted, box-drawn look instead of four ad-hoc ones.

The entry class: PrintRail

PrintRail.sleela is the resolvable, one-class-per-file library unit (no main). Because the driver auto-resolves /lib by scanning capitalized identifiers, just naming PrintRail pulls it in — no import needed:

#sleela 2.5
class MyApp {
    static void main() {
        PrintRail rail = new PrintRail();
        rail.printComponent("MyApp", 5, 7, 1, "started up");   // component line
        rail.printState("WORKING", 7, "crunching numbers", 17); // state line
        rail.printSquarePercent(50);                            // 21x21 square
        rail.debugFrame("compute()", 9, "MyApp.sleela:5", 14);  // bordered table
    }
}
./impl/build/sleela run MyApp.sleela

Why an explicit character count on every call

The Core value model has no string-length or character indexing, so every content primitive takes the content's character count explicitly ("MyApp" → 5). Widths are then measured arithmetically, and cells are padded, never truncated.

What PrintRail renders

ConcernMethods
Professional component lineprintComponent(name, nameChars, oid, dateSeq, message) / componentLine(...)
State-labelled status lineprintState(state, stateChars, message, messageChars) / stateLineText(...)
21×21 progress square (441 cells)printSquare(filledCells), printSquarePercent(percent), percentToCells(percent)
Single-pixel progress indicatorprintPixel(filledCells), printPixelPercent(percent)
Bordered two-column tableprintTable(...), printTableRow(...), printTableTop/Separator/Bottom(...)
Field/value pair (plain or framed)printPair(field, fieldChars, value, valueChars, table)
Producer railscompilerState(...), nordshriftState(...), debugFrame(symbol, symbolChars, location, locationChars)

The builders (componentLine, stateLineText, tableRowText, tableRule) return the rendered string, so a caller can print(...) it or capture it; the print* methods are the convenience surface on top.

The four producer surfaces

Files

FileRole
PrintRail.sleelaThe library unit — the full renderer, auto-resolved by naming PrintRail.
common-rails.sleelaRunnable demo (main) showing all four producer surfaces; ./impl/build/sleela run lib/common-rails/common-rails.sleela.
SLPackage.sleelaPackage facade / descriptor for the common-rails module.
Print*.sleelaPer-concern facade units carrying the Metadata-Class metapattern.

Relation to the rest of the tree

Files 15