// Clay's open/close, in D: `with (ui.column(...)) { children }` closes in a destructor.
struct (struct) scoped2.EnvEnv { bool (field) bool scoped2.Env.compactcompact; }
private struct (struct) scoped2.NamedOnlyNamedOnly {}
struct (struct) scoped2.UiUi
{
uint (field) uint scoped2.Ui.depthdepth; uint (field) uint scoped2.Ui.countcount; (struct) scoped2.EnvEnv (field) scoped2.Env scoped2.Ui.envenv;
char[512] (field) char[512] scoped2.Ui.loglog; uint (field) uint scoped2.Ui.logLenlogLen;
void void scoped2.Ui.note(string s) pure nothrow @nogc @safenote((alias) object.string = stringstring (parameter) string ss) @safe pure nothrow @nogc { (field) char[512] scoped2.Ui.loglog[(field) uint scoped2.Ui.logLenlogLen .. (field) uint scoped2.Ui.logLenlogLen + (parameter) string ss.(field) ulong string.lengthlength] = (parameter) string ss; (field) uint scoped2.Ui.logLenlogLen += cast(uint) (parameter) string ss.(field) ulong string.lengthlength; }
}
/// The open element. It holds nothing a `with` body could name by accident.
struct (struct) scoped2.OpenedThe open element. It holds nothing a with body could name by accident.
Opened
{
private (struct) scoped2.UiUi* (field) scoped2.Ui* scoped2.Opened.ownerowner;
private (struct) scoped2.EnvEnv (field) scoped2.Env scoped2.Opened.savedsaved;
@disable this(this);
~this() scope @safe pure nothrow @nogc
{
if ((field) scoped2.Ui* scoped2.Opened.ownerowner is null) return;
(field) scoped2.Ui* scoped2.Opened.ownerowner.(field) uint scoped2.Ui.depthdepth--; // close: pop, compute the fit size from the children here
(field) scoped2.Ui* scoped2.Opened.ownerowner.(field) scoped2.Env scoped2.Ui.envenv = (field) scoped2.Env scoped2.Opened.savedsaved; // context pops with the element
(field) scoped2.Ui* scoped2.Opened.ownerowner.void scoped2.Ui.note(string s) pure nothrow @nogc @safenote(")");
}
}
(struct) scoped2.OpenedThe open element. It holds nothing a with body could name by accident.
Opened scoped2.Opened scoped2.column(return ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), int gap = 0, bool compact = false, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @trustedcolumn(return ref (struct) scoped2.UiUi (parameter) scoped2.Ui uiui, (struct) scoped2.NamedOnlyNamedOnly (parameter) scoped2.NamedOnly __ = (struct) scoped2.NamedOnlyNamedOnly.(constant) scoped2.NamedOnly scoped2.NamedOnly.init = NamedOnly()init, int (parameter) int gapgap = 0, bool (parameter) bool compactcompact = false,
(alias) object.size_t = ulongsize_t (parameter) ulong lineline = __LINE__) @trusted pure nothrow @nogc
{
(parameter) scoped2.Ui uiui.(field) uint scoped2.Ui.countcount++;
(parameter) scoped2.Ui uiui.(field) uint scoped2.Ui.depthdepth++;
const (local variable) const(scoped2.Env) savedsaved = (parameter) scoped2.Ui uiui.(field) scoped2.Env scoped2.Ui.envenv;
if ((parameter) bool compactcompact) (parameter) scoped2.Ui uiui.(field) scoped2.Env scoped2.Ui.envenv.(field) bool scoped2.Env.compactcompact = true; // known before any child is built
(parameter) scoped2.Ui uiui.void scoped2.Ui.note(string s) pure nothrow @nogc @safenote("(");
return (struct) scoped2.OpenedThe open element. It holds nothing a with body could name by accident.
Opened(&(parameter) scoped2.Ui uiui, (local variable) const(scoped2.Env) savedsaved);
}
void void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safelabel(ref (struct) scoped2.UiUi (parameter) scoped2.Ui uiui, (struct) scoped2.NamedOnlyNamedOnly (parameter) scoped2.NamedOnly __ = (struct) scoped2.NamedOnlyNamedOnly.(constant) scoped2.NamedOnly scoped2.NamedOnly.init = NamedOnly()init, (alias) object.string = stringstring (parameter) string texttext = null, (alias) object.size_t = ulongsize_t (parameter) ulong lineline = __LINE__)
@safe pure nothrow @nogc
{
(parameter) scoped2.Ui uiui.(field) uint scoped2.Ui.countcount++;
(parameter) scoped2.Ui uiui.void scoped2.Ui.note(string s) pure nothrow @nogc @safenote((parameter) scoped2.Ui uiui.(field) scoped2.Env scoped2.Ui.envenv.(field) bool scoped2.Env.compactcompact ? "c" : "L");
}
void void scoped2.pane(ref scoped2.Ui ui, bool computing, in int[] rows) pure nothrow @nogc @safepane(ref (struct) scoped2.UiUi (parameter) scoped2.Ui uiui, bool (parameter) bool computingcomputing, in int[] (parameter) const(int[]) rowsrows) @safe pure nothrow @nogc
{
with ((parameter) scoped2.Ui uiui.scoped2.Opened scoped2.column(return ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), int gap = 0, bool compact = false, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @trustedcolumn(gap: 1))
{
(parameter) scoped2.Ui uiui.void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safelabel(text: "Stats");
if ((parameter) bool computingcomputing)
(parameter) scoped2.Ui uiui.void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safelabel(text: "computing…");
foreach ((parameter) const(int) rr; (parameter) const(int[]) rowsrows)
(parameter) scoped2.Ui uiui.void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safelabel(text: "row");
with ((parameter) scoped2.Ui uiui.scoped2.Opened scoped2.column(return ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), int gap = 0, bool compact = false, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @trustedcolumn(compact: true))
{
(parameter) scoped2.Ui uiui.void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safelabel(text: "inside");
if ((parameter) const(int[]) rowsrows.(field) ulong const(int[]).lengthlength > 1)
return; // early exit still closes both elements
(parameter) scoped2.Ui uiui.void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safelabel(text: "never");
}
(parameter) scoped2.Ui uiui.void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safelabel(text: "after");
}
}
void void D main() @systemmain() @system
{
import (package) stdstd.(module) std.stdioCategory Symbols File handles _popen File isFileHandle openNetwork stderr stdin stdout Reading chunks lines readf readfln readln Writing toFile write writef writefln writeln Misc KeepTerminator LockType StdioException
Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio
is publically imported when importing std.stdio.
There are three layers of I/O:
The lowest layer is the operating system layer. The two main schemes are Windows and Posix.
C's stdio.h which unifies the two operating system schemes.
std.stdio, this module, unifies the various stdio.h implementations into
a high level package for D programs.
Source
std/stdio.d
stdio : (alias template) writeln = std.stdio.writeln(T...)(T args)Equivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Params:
args = the items to write to stdout
Throws:
In case of an I/O error, throws an $(LREF StdioException).
Example:
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
---
writeln;
(struct) scoped2.UiUi (local variable) scoped2.Ui uiui;
static immutable int[2] (immutable global) immutable(int[2]) scoped2.main.rowsrows = [1, 2];
void scoped2.pane(ref scoped2.Ui ui, bool computing, in int[] rows) pure nothrow @nogc @safepane((local variable) scoped2.Ui uiui, true, (immutable global) immutable(int[2]) scoped2.main.rowsrows[]);
void std.stdio.writeln!(char[], string, uint)(char[] __param_0, string __param_1, uint __param_2) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln((local variable) scoped2.Ui uiui.(field) char[512] scoped2.Ui.loglog[0 .. (local variable) scoped2.Ui uiui.(field) uint scoped2.Ui.logLenlogLen], " depth after: ", (local variable) scoped2.Ui uiui.(field) uint scoped2.Ui.depthdepth);
(local variable) scoped2.Ui uiui = (struct) scoped2.UiUi.(constant) scoped2.Ui scoped2.Ui.init = Ui(0u, 0u, Env(false), ['\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff'], 0u)init;
void scoped2.pane(ref scoped2.Ui ui, bool computing, in int[] rows) pure nothrow @nogc @safepane((local variable) scoped2.Ui uiui, false, (immutable global) immutable(int[2]) scoped2.main.rowsrows[0 .. 1]);
void std.stdio.writeln!(char[], string, uint)(char[] __param_0, string __param_1, uint __param_2) @safeEquivalent to write(args, '\n'). Calling writeln without
arguments is valid and just prints a newline to the standard
output.
Example
Reads stdin and writes it to stdout with an argument
counter.
import std.stdio;
void main()
{
string line;
for (size_t count = 0; (line = readln) !is null; count++)
{
writeln("Input ", count, ": ", line);
}
}
writeln((local variable) scoped2.Ui uiui.(field) char[512] scoped2.Ui.loglog[0 .. (local variable) scoped2.Ui uiui.(field) uint scoped2.Ui.logLenlogLen], " depth after: ", (local variable) scoped2.Ui uiui.(field) uint scoped2.Ui.depthdepth);
}