30 using namespace platform;
41 class Log :
private noncopyable
91 Error(
const string& s)
100 FatalError(
const char* s)
109 FatalError(
const string& s)
111 FatalError(s.c_str());
116 #ifdef YSL_USE_MEMORY_DEBUG
119 OnExit_DebugMemory_continue()
121 std::puts(
"Input to continue...");
128 template<std::
size_t _vN,
class _tCon>
130 OnExit_DebugMemory_print(_tCon& con,
const char* item_name)
134 std::fprintf(stderr,
"%i %s(s) detected:\n", con.size(), item_name);
136 typename _tCon::size_type n(0);
138 for(
const auto& item : con)
141 GetDebugMemoryList().Print(item, stderr);
145 OnExit_DebugMemory_continue();
148 OnExit_DebugMemory_continue();
158 using namespace platform;
162 std::puts(
"Normal exit;");
165 OnExit_DebugMemory_print<4>(GetDebugMemoryList().Blocks,
"memory leak");
166 OnExit_DebugMemory_print<4>(GetDebugMemoryList().DuplicateDeletedBlocks,
167 "duplicate memory deleting");
169 DebugMemory.PrintAll(stderr);
170 DebugMemory.PrintAll(
fp);
171 DebugMemory.PrintAllDuplicate(stderr);
172 DebugMemory.PrintAllDuplicate(
fp);
175 std::puts(
"Input to terminate...");
204 using namespace YSLib;
216 using namespace YSLib::UI;
219 Desktop dsk_m(app.GetScreenUp()), dsk_s(app.GetScreenDown());
220 Label lblTitle({50, 20, 100, 22}), lblStatus({60, 80, 120, 22}),
221 lblDetails({30, 20, 160, 22});
227 dsk_m.Background =
SolidBrush({240, 216, 192}),
232 lblStatus.Text = u
"Now loading...",
233 lblDetails.Text = u
"初始化中,请稍后……",
236 lblDetails.Background =
nullptr;
238 yunseq(dsk_m.Validate(), dsk_s.Validate());
239 dsk_m.Update(), dsk_s.Update();
241 for(
size_t i(0); i <
Image_N; ++i)
253 Execute(app, make_shared<YReader::ShlExplorer>());
258 #ifdef YSL_USE_MEMORY_DEBUG
259 OnExit_DebugMemory();
268 log.FatalError(
"Unhandled logged event with level = "
269 +
to_string(e.GetLevel()) +
" : " + e.what());
271 catch(std::exception& e)
275 log.FatalError(
string(
"Unhandled std::exception: ") + e.what());
279 log.FatalError(
"Unhandled exception @ main function;");
std::FILE ConversionState fp
#define DefDeDtor(_t)
定义默认析构函数。
YF_API GUIState & FetchGUIState()
取默认图形用户界面公共状态。
YF_API void YDebugBegin()
调试模式:显示控制台。
void SetInvalidationOf(IWidget &wgt)
void AddWidgets(_tCon &con, _tWidgets &...wgts)
向部件容器添加子部件。
YF_API void Execute(GUIApplication &, shared_ptr< Shell >=make_shared< Shells::GUIShell >())
执行程序主消息循环。
YF_API void YDebugSetStatus(bool=true)
调试模式:设置状态。
YF_API void WaitForInput()
等待任意按键。
#define yunseq
无序列依赖表达式组求值。
#define yconstfn
指定编译时常量函数。
shared_ptr< Image > & FetchImage(size_t)
std::string to_string(unsigned char val)
转换为字符串。
YB_NORETURN YF_API void HandleFatalError(const FatalError &) ynothrow
处理致命错误:显示错误信息并终止程序。
DefDeCtor(BGRA) yconstfn BGRA(typename Trait
File & operator<<(File &f, const Configuration &conf)
void ShowFatalError(const char *s)
yconstexpr size_t Image_N(3)