Ejemplo n.º 1
0
static void
tbl_data(struct termp *tp, const struct tbl_opts *opts,
	const struct tbl_dat *dp,
	const struct roffcol *col)
{

	if (NULL == dp) {
		tbl_char(tp, ASCII_NBRSP, col->width);
		return;
	}
	assert(dp->layout);

	switch (dp->pos) {
	case TBL_DATA_NONE:
		tbl_char(tp, ASCII_NBRSP, col->width);
		return;
	case TBL_DATA_HORIZ:
		/* FALLTHROUGH */
	case TBL_DATA_NHORIZ:
		tbl_char(tp, '-', col->width);
		return;
	case TBL_DATA_NDHORIZ:
		/* FALLTHROUGH */
	case TBL_DATA_DHORIZ:
		tbl_char(tp, '=', col->width);
		return;
	default:
		break;
	}

	switch (dp->layout->pos) {
	case TBL_CELL_HORIZ:
		tbl_char(tp, '-', col->width);
		break;
	case TBL_CELL_DHORIZ:
		tbl_char(tp, '=', col->width);
		break;
	case TBL_CELL_LONG:
		/* FALLTHROUGH */
	case TBL_CELL_CENTRE:
		/* FALLTHROUGH */
	case TBL_CELL_LEFT:
		/* FALLTHROUGH */
	case TBL_CELL_RIGHT:
		tbl_literal(tp, dp, col);
		break;
	case TBL_CELL_NUMBER:
		tbl_number(tp, opts, dp, col);
		break;
	case TBL_CELL_DOWN:
		tbl_char(tp, ASCII_NBRSP, col->width);
		break;
	default:
		abort();
		/* NOTREACHED */
	}
}
Ejemplo n.º 2
0
static void
tbl_data(struct termp *tp, const struct tbl *tbl,
		const struct tbl_dat *dp, 
		const struct roffcol *col)
{
	enum tbl_cellt	 pos;

	if (NULL == dp) {
		tbl_char(tp, ASCII_NBRSP, col->width);
		return;
	}

	switch (dp->pos) {
	case (TBL_DATA_NONE):
		tbl_char(tp, ASCII_NBRSP, col->width);
		return;
	case (TBL_DATA_HORIZ):
		/* FALLTHROUGH */
	case (TBL_DATA_NHORIZ):
		tbl_char(tp, '-', col->width);
		return;
	case (TBL_DATA_NDHORIZ):
		/* FALLTHROUGH */
	case (TBL_DATA_DHORIZ):
		tbl_char(tp, '=', col->width);
		return;
	default:
		break;
	}
	
	pos = dp && dp->layout ? dp->layout->pos : TBL_CELL_LEFT;

	switch (pos) {
	case (TBL_CELL_HORIZ):
		tbl_char(tp, '-', col->width);
		break;
	case (TBL_CELL_DHORIZ):
		tbl_char(tp, '=', col->width);
		break;
	case (TBL_CELL_LONG):
		/* FALLTHROUGH */
	case (TBL_CELL_CENTRE):
		/* FALLTHROUGH */
	case (TBL_CELL_LEFT):
		/* FALLTHROUGH */
	case (TBL_CELL_RIGHT):
		tbl_literal(tp, dp, col);
		break;
	case (TBL_CELL_NUMBER):
		tbl_number(tp, tbl, dp, col);
		break;
	default:
		abort();
		/* NOTREACHED */
	}
}