=================================================================== RCS file: /cvs/mandoc/term.h,v retrieving revision 1.60 retrieving revision 1.65 diff -u -p -r1.60 -r1.65 --- mandoc/term.h 2010/06/08 15:00:17 1.60 +++ mandoc/term.h 2010/06/25 18:53:14 1.65 @@ -1,6 +1,6 @@ -/* $Id: term.h,v 1.60 2010/06/08 15:00:17 kristaps Exp $ */ +/* $Id: term.h,v 1.65 2010/06/25 18:53:14 kristaps Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -41,12 +41,17 @@ enum termfont { typedef void (*term_margin)(struct termp *, const void *); struct termp_ps { - int psstate; /* -Tps: state of ps output */ -#define PS_INLINE (1 << 0) -#define PS_MARGINS (1 << 1) - size_t pscol; /* -Tps: visible column */ - size_t psrow; /* -Tps: visible row */ - size_t pspage; /* -Tps: current page */ + int psstate; /* state of ps output */ +#define PS_INLINE (1 << 0) /* we're in a word */ +#define PS_MARGINS (1 << 1) /* we're in the margins */ + size_t pscol; /* visible column */ + size_t psrow; /* visible row */ + char *psmarg; /* margin buf */ + size_t psmargsz; /* margin buf size */ + size_t psmargcur; /* current pos in margin buf */ + size_t pspage; /* current page */ + char last; /* character buffer */ + enum termfont lastf; /* last set font */ }; struct termp { @@ -86,6 +91,7 @@ struct termp { void (*end)(struct termp *); void (*endline)(struct termp *); void (*advance)(struct termp *, size_t); + size_t (*width)(const struct termp *, char); const void *argf; /* arg for headf/footf */ union { struct termp_ps ps; @@ -102,8 +108,12 @@ void term_begin(struct termp *, term_margin, term_margin, const void *); void term_end(struct termp *); -size_t term_hspan(const struct roffsu *); -size_t term_vspan(const struct roffsu *); +size_t term_hspan(const struct termp *, + const struct roffsu *); +size_t term_vspan(const struct termp *, + const struct roffsu *); +size_t term_strlen(const struct termp *, const char *); +size_t term_len(const struct termp *, size_t); enum termfont term_fonttop(struct termp *); const void *term_fontq(struct termp *);