#!/usr/bin/env dub
/+ dub.sdl:
name "close-policy"
targetPath "build"
dependency "sparkles:ui-app" path="../../.."
buildType "checked" {
buildOptions "optimize" "inline" "debugInfo"
}
+/
/// A close decision can outlive the native request that opened it.
module (module) close_policyA close decision can outlive the native request that opened it.
close_policy;
import sparkles.ui_app.record : RecordingHost;
import sparkles.ui_app.run_app : requestAppClose;
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) close_policy.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.
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 (struct) close_policy.AppApp
{
bool (field) bool close_policy.App.approvedapproved;
void void closeRequested(H)(ref H host)closeRequested(H)(ref H (parameter) H hosthost)
{
if (approved) host.quit();
}
}
void void D main() @safemain() @safe
{
(struct) close_policy.AppApp (local variable) close_policy.App appapp;
RecordingHost (local variable) _error_ hosthost;
requestAppClose(app, host);
assert(!host.quitRequested);
void std.stdio.writeln!string(string __param_0) @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("close deferred");
(local variable) close_policy.App appapp.(field) bool close_policy.App.approvedapproved = true;
requestAppClose(app, host);
assert(host.quitRequested);
void std.stdio.writeln!string(string __param_0) @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("close approved");
}