10 ///We add the do/while so that the statement "if (condition) b3Printf("test"); else {...}" would fail
11 ///You can also customize the message by uncommenting out a different line below
12 #define b3Printf(...) b3OutputPrintfVarArgsInternal(__VA_ARGS__)
13 //#define b3Printf(...) do {b3OutputPrintfVarArgsInternal("b3Printf[%s,%d]:",__FILE__,__LINE__);b3OutputPrintfVarArgsInternal(__VA_ARGS__); } while(0)
14 //#define b3Printf b3OutputPrintfVarArgsInternal
15 //#define b3Printf(...) printf(__VA_ARGS__)
16 //#define b3Printf(...)
17 #define b3Warning(...) do{ b3OutputWarningMessageVarArgsInternal("b3Warning[%s,%d]:\n", __FILE__, __LINE__);b3OutputWarningMessageVarArgsInternal(__VA_ARGS__);} while (0)
18 #define b3Error(...)do {b3OutputErrorMessageVarArgsInternal("b3Error[%s,%d]:\n", __FILE__, __LINE__);b3OutputErrorMessageVarArgsInternal(__VA_ARGS__);} while (0)
21 void b3EnterProfileZone(const char* name);
22 void b3LeaveProfileZone();
28 b3ProfileZone(const char* name)
30 b3EnterProfileZone(name);
39 #define B3_PROFILE(name) b3ProfileZone __profile(name)
44 #define B3_PROFILE(name)
45 #define b3StartProfile(a)
48 #endif //#ifndef B3_NO_PROFILE
50 typedef void(b3PrintfFunc)(const char* msg);
51 typedef void(b3WarningMessageFunc)(const char* msg);
52 typedef void(b3ErrorMessageFunc)(const char* msg);
53 typedef void(b3EnterProfileZoneFunc)(const char* msg);
54 typedef void(b3LeaveProfileZoneFunc)();
56 ///The developer can route b3Printf output using their own implementation
57 void b3SetCustomPrintfFunc(b3PrintfFunc* printfFunc);
58 void b3SetCustomWarningMessageFunc(b3WarningMessageFunc* warningMsgFunc);
59 void b3SetCustomErrorMessageFunc(b3ErrorMessageFunc* errorMsgFunc);
61 ///Set custom profile zone functions (zones can be nested)
62 void b3SetCustomEnterProfileZoneFunc(b3EnterProfileZoneFunc* enterFunc);
63 void b3SetCustomLeaveProfileZoneFunc(b3LeaveProfileZoneFunc* leaveFunc);
65 ///Don't use those internal functions directly, use the b3Printf or b3SetCustomPrintfFunc instead (or warning/error version)
66 void b3OutputPrintfVarArgsInternal(const char* str, ...);
67 void b3OutputWarningMessageVarArgsInternal(const char* str, ...);
68 void b3OutputErrorMessageVarArgsInternal(const char* str, ...);