module std.stdio;

import dlib.util;
import std.traits;
import wasm;
import std.format;

void
writefln(alias fmt, A...)(A args) if(isSomeString!(typeof(fmt)))
{
	.writefln(Str(fmt), args);
}

void
writefln(Char, A...)(in Char[] fmt, A args)
{
	char[1024] buffer;

	string result = Str(sformat(buffer, fmt, args));

	Console(result, true);
}

void
writef(alias fmt, A...)(A args) if(isSomeString!(typeof(fmt)))
{
	.writef(Str(fmt), args);
}

void
writef(Char, A...)(in Char[] fmt, A args)
{	
	char[1024] buffer;

	string result = Str(sformat(buffer, fmt, args));

	Console(result, false);
}

void
write(T...)(T args) if(T.length == 1 && isSomeString!(T[0]))
{
	Console(Str(args[0]), false);
}

void
writeln(T...)(T args) if(T.length == 1 && isSomeString!(T[0]))
{
	Console(Str(args[0]), true);
}
