tbl_term.c revision 260e9a87725c090ba5835b1f9f0b62fa2f96036f
/* $Id: tbl_term.c,v 1.40 2015/03/06 15:48:53 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mandoc.h"
#include "out.h"
#include "term.h"
static size_t term_tbl_strlen(const char *, void *);
const struct tbl_dat *,
const struct roffcol *);
const struct roffcol *);
const struct tbl_dat *,
const struct roffcol *);
static size_t
term_tbl_strlen(const char *p, void *arg)
{
}
static size_t
{
}
void
{
/* Inhibit printing of spaces: we do padding ourselves. */
/*
* The first time we're invoked for a given table block,
* calculate the table widths and decimal positions.
*/
/* Center the table as a whole. */
tsz -= 3;
tsz -= 1;
}
/* Horizontal frame at the start of boxed tables. */
}
/* Vertical frame at the start of each row. */
/*
* Now print the actual data itself depending on the span type.
* Match data cells to column numbers.
*/
spans = 0;
/*
* Remeber whether we need a vertical bar
* after this cell.
*/
/*
* Print the data and advance to the next cell.
*/
if (spans == 0) {
}
} else
spans--;
/*
* Separate columns, except in the middle
* of spans and after the last cell.
*/
continue;
if (vert > 0)
if (vert < 2)
}
} else if (horiz)
/* Vertical frame at the end of each row. */
/*
* If we're the last row, clean up after ourselves: clear the
* existing table configuration and set it to NULL.
*/
}
}
}
}
/*
* Kinds of horizontal rulers:
* 0: inside the table (single or double line with crossings)
* 1: inner frame (single line with crossings and ends)
* 2: outer frame (single line without crossings with ends)
*/
static void
{
int vert;
if (kind)
for (;;) {
break;
}
if (vert)
if (vert < 2)
}
if (kind) {
}
}
static void
{
return;
}
case TBL_DATA_NONE:
return;
case TBL_DATA_HORIZ:
/* FALLTHROUGH */
case TBL_DATA_NHORIZ:
return;
case TBL_DATA_NDHORIZ:
/* FALLTHROUGH */
case TBL_DATA_DHORIZ:
return;
default:
break;
}
case TBL_CELL_HORIZ:
break;
case TBL_CELL_DHORIZ:
break;
case TBL_CELL_LONG:
/* FALLTHROUGH */
case TBL_CELL_CENTRE:
/* FALLTHROUGH */
case TBL_CELL_LEFT:
/* FALLTHROUGH */
case TBL_CELL_RIGHT:
break;
case TBL_CELL_NUMBER:
break;
case TBL_CELL_DOWN:
break;
default:
abort();
/* NOTREACHED */
}
}
static void
{
char cp[2];
cp[0] = c;
}
static void
{
while (spans--)
padl = 0;
case TBL_CELL_LONG:
break;
case TBL_CELL_CENTRE:
if (2 > padr)
break;
break;
case TBL_CELL_RIGHT:
padr = 0;
break;
default:
break;
}
}
static void
{
char *cp;
char buf[2];
int i;
/*
* See calc_data_number(). Left-pad by taking the offset of our
* and the maximum decimal; right-pad by the remaining amount.
*/
}
} else
} else
padl = 0;
}
static void
{
int prev_font;
}