//---------------------------------------------------------------------------------------------------------------------- // init_command_line_params //---------------------------------------------------------------------------------------------------------------------- static bool init_command_line_params(int argc, char *argv[]) { VOGL_FUNC_TRACER command_line_params::parse_config parse_cfg; parse_cfg.m_single_minus_params = true; parse_cfg.m_double_minus_params = true; if (!g_command_line_params().parse(get_command_line_params(argc, argv), VOGL_ARRAY_SIZE(g_command_line_param_descs), g_command_line_param_descs, parse_cfg)) { vogl_error_printf("%s: Failed parsing command line parameters!\n", VOGL_FUNCTION_NAME); return false; } if (!init_logfile()) return false; if (g_command_line_params().get_value_as_bool("help") || g_command_line_params().get_value_as_bool("?")) { tool_print_help(); return false; } return true; }
//---------------------------------------------------------------------------------------------------------------------- // main //---------------------------------------------------------------------------------------------------------------------- int main(int argc, char *argv[]) { #if VOGL_FUNCTION_TRACING fflush(stdout); fflush(stderr); setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); #endif VOGL_FUNC_TRACER // Initialize vogl_core. vogl_core_init(); XSetErrorHandler(xerror_handler); if (!voglbench_init(argc, argv)) { voglbench_deinit(); return EXIT_FAILURE; } if (g_command_line_params().get_count("") < 2) { vogl_error_printf("No trace file specified!\n"); tool_print_help(); voglbench_deinit(); return EXIT_FAILURE; } if (g_command_line_params().get_value_as_bool("pause")) { vogl_message_printf("Press key to continue\n"); vogl_sleep(1000); getchar(); } bool success = tool_replay_mode(); vogl_printf("%u warning(s), %u error(s)\n", console::get_total_messages(cWarningConsoleMessage), console::get_total_messages(cErrorConsoleMessage)); voglbench_deinit(); return success ? EXIT_SUCCESS : EXIT_FAILURE; }
//---------------------------------------------------------------------------------------------------------------------- // main //---------------------------------------------------------------------------------------------------------------------- int main(int argc, char *argv[]) { #if VOGL_FUNCTION_TRACING fflush(stdout); fflush(stderr); setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); #endif VOGL_FUNC_TRACER // Initialize vogl_core. vogl_core_init(); if (!voglsyms_init(argc, argv)) { voglsyms_deinit(); return EXIT_FAILURE; } if (g_command_line_params().get_count("") < 2) { vogl_error_printf("No trace file specified!\n"); tool_print_help(); voglsyms_deinit(); return EXIT_FAILURE; } if (g_command_line_params().get_value_as_bool("pause")) { vogl_message_printf("Press key to continue\n"); vogl_sleep(1000); getchar(); } bool success = voglsym_main_loop(argv); voglsyms_deinit(); return success ? EXIT_SUCCESS : EXIT_FAILURE; }