tbl_term.c (280025) | tbl_term.c (294113) |
---|---|
1/* $Id: tbl_term.c,v 1.40 2015/03/06 15:48:53 schwarze Exp $ */ | 1/* $Id: tbl_term.c,v 1.43 2015/10/12 00:08:16 schwarze Exp $ */ |
2/* 3 * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv> 4 * Copyright (c) 2011, 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * --- 32 unchanged lines hidden (view full) --- 42static void tbl_hrule(struct termp *, const struct tbl_span *, int); 43static void tbl_word(struct termp *, const struct tbl_dat *); 44 45 46static size_t 47term_tbl_strlen(const char *p, void *arg) 48{ 49 | 2/* 3 * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv> 4 * Copyright (c) 2011, 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * --- 32 unchanged lines hidden (view full) --- 42static void tbl_hrule(struct termp *, const struct tbl_span *, int); 43static void tbl_word(struct termp *, const struct tbl_dat *); 44 45 46static size_t 47term_tbl_strlen(const char *p, void *arg) 48{ 49 |
50 return(term_strlen((const struct termp *)arg, p)); | 50 return term_strlen((const struct termp *)arg, p); |
51} 52 53static size_t 54term_tbl_len(size_t sz, void *arg) 55{ 56 | 51} 52 53static size_t 54term_tbl_len(size_t sz, void *arg) 55{ 56 |
57 return(term_len((const struct termp *)arg, sz)); | 57 return term_len((const struct termp *)arg, sz); |
58} 59 60void 61term_tbl(struct termp *tp, const struct tbl_span *sp) 62{ 63 const struct tbl_cell *cp; 64 const struct tbl_dat *dp; 65 static size_t offset; --- 195 unchanged lines hidden (view full) --- 261 return; 262 } 263 264 switch (dp->pos) { 265 case TBL_DATA_NONE: 266 tbl_char(tp, ASCII_NBRSP, col->width); 267 return; 268 case TBL_DATA_HORIZ: | 58} 59 60void 61term_tbl(struct termp *tp, const struct tbl_span *sp) 62{ 63 const struct tbl_cell *cp; 64 const struct tbl_dat *dp; 65 static size_t offset; --- 195 unchanged lines hidden (view full) --- 261 return; 262 } 263 264 switch (dp->pos) { 265 case TBL_DATA_NONE: 266 tbl_char(tp, ASCII_NBRSP, col->width); 267 return; 268 case TBL_DATA_HORIZ: |
269 /* FALLTHROUGH */ | |
270 case TBL_DATA_NHORIZ: 271 tbl_char(tp, '-', col->width); 272 return; 273 case TBL_DATA_NDHORIZ: | 269 case TBL_DATA_NHORIZ: 270 tbl_char(tp, '-', col->width); 271 return; 272 case TBL_DATA_NDHORIZ: |
274 /* FALLTHROUGH */ | |
275 case TBL_DATA_DHORIZ: 276 tbl_char(tp, '=', col->width); 277 return; 278 default: 279 break; 280 } 281 282 switch (dp->layout->pos) { 283 case TBL_CELL_HORIZ: 284 tbl_char(tp, '-', col->width); 285 break; 286 case TBL_CELL_DHORIZ: 287 tbl_char(tp, '=', col->width); 288 break; 289 case TBL_CELL_LONG: | 273 case TBL_DATA_DHORIZ: 274 tbl_char(tp, '=', col->width); 275 return; 276 default: 277 break; 278 } 279 280 switch (dp->layout->pos) { 281 case TBL_CELL_HORIZ: 282 tbl_char(tp, '-', col->width); 283 break; 284 case TBL_CELL_DHORIZ: 285 tbl_char(tp, '=', col->width); 286 break; 287 case TBL_CELL_LONG: |
290 /* FALLTHROUGH */ | |
291 case TBL_CELL_CENTRE: | 288 case TBL_CELL_CENTRE: |
292 /* FALLTHROUGH */ | |
293 case TBL_CELL_LEFT: | 289 case TBL_CELL_LEFT: |
294 /* FALLTHROUGH */ | |
295 case TBL_CELL_RIGHT: 296 tbl_literal(tp, dp, col); 297 break; 298 case TBL_CELL_NUMBER: 299 tbl_number(tp, opts, dp, col); 300 break; 301 case TBL_CELL_DOWN: 302 tbl_char(tp, ASCII_NBRSP, col->width); 303 break; 304 default: 305 abort(); | 290 case TBL_CELL_RIGHT: 291 tbl_literal(tp, dp, col); 292 break; 293 case TBL_CELL_NUMBER: 294 tbl_number(tp, opts, dp, col); 295 break; 296 case TBL_CELL_DOWN: 297 tbl_char(tp, ASCII_NBRSP, col->width); 298 break; 299 default: 300 abort(); |
306 /* NOTREACHED */ | |
307 } 308} 309 310static void 311tbl_char(struct termp *tp, char c, size_t len) 312{ 313 size_t i, sz; 314 char cp[2]; --- 112 unchanged lines hidden --- | 301 } 302} 303 304static void 305tbl_char(struct termp *tp, char c, size_t len) 306{ 307 size_t i, sz; 308 char cp[2]; --- 112 unchanged lines hidden --- |