kernel.core.kprintf



template kprintf(char[] Format)
This template will generate code for printing and will do all parsing of the format string at compile time

USAGE:
kprintf!("format string {specifier} ... ")(args...);

Examples:
kprintf!("Integer: {}")(10); kprintf!("{!cls}Cleared the screen.")(); kprintf!("{!pos:2,3}At position (2,3)")(); kprintf!("{!fg:LightBlue!bg:Gray}{}")(25); kprintf!("{!fg:Red}redness")(); kprintf!("{x} Hex!")(145); kprintf!("Curly Brace: {{")();

COMMANDS:
!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.

SPECIFIERS:
{x} - Prints the hex value. {u} - Treats as unsigned. {} - Prints common form.

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.

- So we can do this and not care about the output of the function:

auto blah = someFunction(); kprintf!("Some Arbitrary Info: {}")(blah);

WOWWY WOW WOW!

template kprintfln(char[] Format)
This template will generate code like kprintf but will also print a newline afterward.

USAGE:
See kprintf.


Page generated by Ddoc.