Exemplo n.º 1
0
extern void
print_week_range(Calendar * c, Tick start_tick, Tick end_tick)
{

    Props 		*p = (Props *)c->properties;
    register Tick 	first_date = start_tick;
    int 		num_weeks;
    Boolean 	done = False, first = True;
    int 		num_page = 1;
    void *xp = (void *)NULL;

    /* get number of weeks needed to print */

    num_weeks = ((end_tick - start_tick)/wksec) + 1;

    if (num_weeks <= 0)
        num_weeks = 1;

    first_date = first_dow(first_date);
    if (!timeok(first_date))
        first_date = get_bot();

    if ((xp = x_open_file(c)) == (void *)NULL)
        return;

    for (; num_weeks > 0; num_weeks--) {
        while (!done) {
            done = print_week(c, num_page, xp, first_date, p, first);
            num_page++;
            first = False;
        }
        done = False;
        num_page = 1;
    }

    x_print_file(xp, c);
}
Exemplo n.º 2
0
Arquivo: rc.c Projeto: andybug/spreden
static void print_rc(const struct rc *rc)
{
	const char *action = "unknown";

	/*
	 * map action to string
	 * if not analyze, predict, or rank, then exit
	 */
	switch (rc->action) {
	case ACTION_ANALYZE:
		action = "analyze";
		break;
	case ACTION_PREDICT:
		action = "predict";
		break;
	case ACTION_RANK:
		action = "rank";
		break;
	default:
		return;
	}

	/* heading */
	fputs("***** run control *****\n", stderr);

	/* print action */
	fprintf(stderr, "action:       %s\n", action);

	/* print sport */
	fprintf(stderr, "sport:        %s\n", rc->sport);

	/* print data-begin week */
	fputs("data-begin:   ", stderr);
	print_week(stderr, &rc->data_begin);
	fputc('\n', stderr);

	/* print end week */
	fputs("data-end:     ", stderr);
	print_week(stderr, &rc->data_end);
	fputc('\n', stderr);

	/* print target week/range */
	fputs("target-begin: ", stderr);
	print_week(stderr, &rc->target_begin);
	fputc('\n', stderr);

	fputs("target-end:   ", stderr);
	print_week(stderr, &rc->target_end);
	fputc('\n', stderr);

	/* print algos */
	fputs("algos:        [ ", stderr);
	struct list_iter iter;
	char *algo;
	list_iter_begin(&rc->user_algorithms, &iter);
	while (!list_iter_end(&iter)) {
		algo = list_iter_data(&iter);
		fprintf(stderr, "%s ", algo);
		list_iter_next(&iter);
	}
	fputs("]\n", stderr);

	/* footer */
	fputs("***********************\n", stderr);
}