MCPcopy Create free account
hub / github.com/crownengine/crown / main_data_compiler

Function main_data_compiler

src/resource/data_compiler.cpp:1718–1836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1716
1717#undef RESOURCE_TYPE
1718int main_data_compiler(const DeviceOptions &opts)
1719{
1720#if CROWN_PLATFORM_WINDOWS
1721 // code-format off
1722 PHANDLER_ROUTINE signal_handler = [](DWORD dwCtrlType) {
1723 switch (dwCtrlType) {
1724 case CTRL_C_EVENT:
1725 _quit = true;
1726 if (console_server())
1727 console_server()->shutdown();
1728 return TRUE;
1729
1730 default:
1731 return FALSE;
1732 }
1733 };
1734 SetConsoleCtrlHandler(signal_handler, TRUE);
1735#else
1736 struct sigaction old_SIGINT;
1737 struct sigaction old_SIGTERM;
1738 struct sigaction act;
1739 act.sa_handler = [](int signum) {
1740 switch (signum)
1741 {
1742 case SIGINT:
1743 case SIGTERM:
1744 _quit = true;
1745 if (console_server())
1746 console_server()->shutdown();
1747 break;
1748
1749 default:
1750 break;
1751 }
1752 };
1753 sigemptyset(&act.sa_mask);
1754 act.sa_flags = 0;
1755 sigaction(SIGINT, NULL, &old_SIGINT);
1756 sigaction(SIGINT, &act, NULL);
1757 sigaction(SIGTERM, NULL, &old_SIGTERM);
1758 sigaction(SIGTERM, &act, NULL);
1759 // code-format on
1760#endif // if CROWN_PLATFORM_WINDOWS
1761
1762 console_server_globals::init();
1763 if (opts._server)
1764 console_server()->listen(opts._console_port
1765 , opts._wait_console
1766 , opts._port_file.empty() ? NULL : opts._port_file.c_str()
1767 , CROWN_DEFAULT_COMPILER_PORT
1768 );
1769
1770 MeshCache mesh_cache;
1771
1772 DataCompiler *dc = CE_NEW(default_allocator(), DataCompiler)(opts, *console_server());
1773 dc->register_compiler("config", RESOURCE_VERSION_CONFIG, config_resource_internal::compile);
1774 dc->register_compiler("font", RESOURCE_VERSION_FONT, font_resource_internal::compile);
1775 dc->register_compiler("level", RESOURCE_VERSION_LEVEL, level_resource_internal::compile);

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 13

console_serverFunction · 0.85
register_compilerMethod · 0.80
map_source_dirMethod · 0.80
scan_and_restoreMethod · 0.80
sigactionClass · 0.70
initFunction · 0.50
shutdownFunction · 0.50
shutdownMethod · 0.45
listenMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected