Example #1
0
int main(int argc, char ** argv)
{
    /* all in one initialize */
    initialize(argc, argv);

    /* whole-search loop */
    for(;;) {
        /* create initial-path by each mode */
        initial_path();

        /* search-turn loop */
        for(;;) {
            /* search */
            search();

            /* counting turn-num */
            num_counter(TURN_COUNTER, ADD);

            /* search-turn terminate */
            if(loop_terminate() == YES) {break;}
        }

        /* counting turn-num */
        num_counter(SEARCH_COUNTER, ADD);

        /* whole-search-terminate */
        if(search_terminate() == YES) {break;}
    }

    /* finalize procedure */
    finalize();

    return 0;
}
Example #2
0
int main(void)
{
	struct json_object *cmd;
	engine_callback = main_callback;

	if (engine_init() < 0)
		exit(1);

	signal(SIGINT, stop_loop);
	loop_init();

	initscr();
	cbreak();
	noecho();
	keypad(stdscr, TRUE);

	win_body_lines = LINES - 8;
	
	// If you don't do this, the service config form won't be displayed
	while (win_body_lines % 4 != 3)
		win_body_lines--;

	win_body = newwin(win_body_lines + 2, COLS, 2, 0);
	box(win_body, 0 , 0);
	keypad(win_body, TRUE);

	win_header = newwin(2, COLS, 0, 0);
	win_footer = newwin(2, COLS, LINES-2, 0);

	// Print all windows, according to the man it's more efficient than 3
	wnoutrefresh(win_header);
	wnoutrefresh(win_body);
	wnoutrefresh(win_footer);
	doupdate();

	context.current_context = CONTEXT_HOME;
	context.serv = malloc(sizeof(struct userptr_data));
	assert(context.serv != NULL);
	context.tech = malloc(sizeof(struct userptr_data));
	assert(context.tech != NULL);

	// get_home_page (and render it)
	cmd = json_object_new_object();
	json_object_object_add(cmd, key_command, json_object_new_string("get_home_page"));
	engine_query(cmd);

	loop_run(true);
	loop_terminate();

	delwin(win_header);
	delwin(win_body);
	delwin(win_footer);
	endwin();

	return 0;
}