mirror of
https://github.com/xomboverlord/xomb-docs.git
synced 2026-01-11 18:33:17 +01:00
70 lines
2.1 KiB
HTML
70 lines
2.1 KiB
HTML
<html><head>
|
|
<META http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<title>kernel.core.kprintf</title>
|
|
</head><body>
|
|
<h1>kernel.core.kprintf</h1>
|
|
<!-- Generated by Ddoc from ../kernel/core/kprintf.d -->
|
|
<br><br>
|
|
<dl><dt><big>template <u>kprintf</u>(char[] Format)</big></dt>
|
|
<dd>This template will generate code for printing and will do
|
|
all parsing of the format string at compile time
|
|
<br><br>
|
|
<b>USAGE:</b><br>
|
|
<u>kprintf</u>!("format string {specifier} ... ")(args...);
|
|
|
|
<br><br>
|
|
<b>Examples:</b><br>
|
|
<u>kprintf</u>!("Integer: {}")(10);
|
|
<u>kprintf</u>!("{!cls}Cleared the screen.")();
|
|
<u>kprintf</u>!("{!pos:2,3}At position (2,3)")();
|
|
<u>kprintf</u>!("{!fg:LightBlue!bg:Gray}{}")(25);
|
|
<u>kprintf</u>!("{!fg:Red}redness")();
|
|
<u>kprintf</u>!("{x} Hex!")(145);
|
|
<u>kprintf</u>!("Curly Brace: {{")();
|
|
|
|
<br><br>
|
|
<b>COMMANDS:</b><br>
|
|
!cls - Clears the screen.
|
|
!fg - Sets the foreground color, see the Color enum
|
|
in kernel/dev/console.d.
|
|
!bg - Sets the background color, same as above.
|
|
!pos - Moves the cursor to the x and y given, see example above.
|
|
|
|
<br><br>
|
|
<b>SPECIFIERS:</b><br>
|
|
{x} - Prints the hex value.
|
|
{u} - Treats as unsigned.
|
|
{} - Prints common form.
|
|
<br><br>
|
|
|
|
WHY IS IT COOL?
|
|
- Compile time parsing of format strings
|
|
- Type checking at compile time as well
|
|
- That means it can tell you that you are dumb before you execute.
|
|
- No need to specify type information.
|
|
<br><br>
|
|
|
|
- So we can do this and not care about the
|
|
output of the function:
|
|
<br><br>
|
|
|
|
auto blah = someFunction();
|
|
<u>kprintf</u>!("Some Arbitrary Info: {}")(blah);
|
|
<br><br>
|
|
|
|
WOWWY WOW WOW!<br><br>
|
|
|
|
</dd>
|
|
<dt><big>template <u>kprintfln</u>(char[] Format)</big></dt>
|
|
<dd>This template will generate code like kprintf but will also
|
|
print a newline afterward.
|
|
<br><br>
|
|
<b>USAGE:</b><br>
|
|
See kprintf.<br><br>
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
<hr><small>Page generated by <a href="http://www.digitalmars.com/d/1.0/ddoc.html">Ddoc</a>. </small>
|
|
</body></html>
|