1 module Dgame.Internal.Error;
2 
3 package(Dgame):
4 
5 @nogc
6 void assert_fmt(Args...)(void* ptr, string msg, auto ref Args args) nothrow {
7 	return assert_fmt(ptr !is null, msg, args);
8 }
9 
10 @nogc
11 void assert_fmt(Args...)(bool cond, string msg, auto ref Args args) nothrow {
12     import core.stdc.stdio : sprintf;
13 
14     char[256] buf = void;
15 
16     sprintf(buf.ptr, msg.ptr, args);
17     assert(cond, buf);
18 }
19 
20 @nogc
21 void print_fmt(Args...)(string fmt, auto ref Args args) nothrow {
22     import core.stdc.stdio : printf;
23 
24     printf(fmt.ptr, args);
25 }