-/* $Id: mandoc.h,v 1.260 2018/12/14 05:18:02 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.274 2021/08/14 13:53:08 schwarze Exp $ */
/*
+ * Copyright (c) 2012-2021 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2012-2018 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
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Error handling, escape sequence, and character utilities.
+ * Can be used by all code in the mandoc package.
*/
#define ASCII_NBRSP 31 /* non-breaking space */
MANDOCERR_ARCH_BAD, /* unknown architecture: Dt ... arch */
MANDOCERR_OS_ARG, /* operating system explicitly specified: Os ... */
MANDOCERR_RCS_MISSING, /* RCS id missing */
- MANDOCERR_XR_BAD, /* referenced manual not found: Xr name sec */
MANDOCERR_STYLE, /* ===== start of style suggestions ===== */
MANDOCERR_BX, /* consider using OS macro: macro */
MANDOCERR_ER_ORDER, /* errnos out of order: Er ... */
MANDOCERR_ER_REP, /* duplicate errno: Er ... */
+ MANDOCERR_XR_BAD, /* referenced manual not found: Xr name sec */
MANDOCERR_DELIM, /* trailing delimiter: macro ... */
MANDOCERR_DELIM_NB, /* no blank before trailing delimiter: macro ... */
MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping: fi */
MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping: nf */
+ MANDOCERR_TEXT_LONG, /* input text line longer than 80 bytes */
MANDOCERR_DASHDASH, /* verbatim "--", maybe consider using \(em */
MANDOCERR_FUNC, /* function name without markup: name() */
MANDOCERR_SPACE_EOL, /* whitespace at end of input line */
MANDOCERR_TH_NOTITLE, /* missing manual title, using "": [macro] */
MANDOCERR_MSEC_MISSING, /* missing manual section, using "": macro */
MANDOCERR_MSEC_BAD, /* unknown manual section: Dt ... section */
- MANDOCERR_DATE_MISSING, /* missing date, using today's date */
+ MANDOCERR_MSEC_FILE, /* filename/section mismatch: ... */
+ MANDOCERR_DATE_MISSING, /* missing date, using "": [macro] */
MANDOCERR_DATE_BAD, /* cannot parse date, using it verbatim: date */
MANDOCERR_DATE_FUTURE, /* date in the future, using it anyway: date */
MANDOCERR_OS_MISSING, /* missing Os macro, using "" */
MANDOCERR_FI_TAB, /* tab in filled text */
MANDOCERR_EOS, /* new sentence, new line */
MANDOCERR_ESC_BAD, /* invalid escape sequence: esc */
+ MANDOCERR_ESC_UNDEF, /* undefined escape, printing literally: char */
MANDOCERR_STR_UNDEF, /* undefined string, using "": name */
/* related to tables */
MANDOCERR_TBLLAYOUT_NONE, /* empty tbl layout */
MANDOCERR_TBLLAYOUT_CHAR, /* invalid character in tbl layout: char */
MANDOCERR_TBLLAYOUT_PAR, /* unmatched parenthesis in tbl layout */
+ MANDOCERR_TBLLAYOUT_SPC, /* ignoring excessive spacing in tbl layout */
MANDOCERR_TBLDATA_NONE, /* tbl without any data cells */
MANDOCERR_TBLDATA_SPAN, /* ignoring data in spanned tbl cell: data */
MANDOCERR_TBLDATA_EXTRA, /* ignoring extra tbl data cells: data */
MANDOCERR_TBLDATA_BLK, /* data block open at end of tbl: macro */
/* related to document structure and macros */
- MANDOCERR_FILE, /* cannot open file */
MANDOCERR_PROLOG_REP, /* duplicate prologue macro: macro */
MANDOCERR_DT_LATE, /* skipping late title macro: Dt args */
MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */
MANDOCERR_SHIFT, /* excessive shift: ..., but max is ... */
MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */
MANDOCERR_SO_FAIL, /* .so request failed */
+ MANDOCERR_TG_SPC, /* skipping tag containing whitespace: tag */
MANDOCERR_ARG_SKIP, /* skipping all arguments: macro args */
MANDOCERR_ARG_EXCESS, /* skipping excess arguments: macro ... args */
MANDOCERR_DIVZERO, /* divide by zero */
MANDOCERR_TOOLARGE, /* input too large */
MANDOCERR_CHAR_UNSUPP, /* unsupported control character: number */
+ MANDOCERR_ESC_UNSUPP, /* unsupported escape sequence: escape */
MANDOCERR_REQ_UNSUPP, /* unsupported roff request: request */
MANDOCERR_WHILE_NEST, /* nested .while loops */
MANDOCERR_WHILE_OUTOF, /* end of scope with open .while loop */
MANDOCERR_TBLOPT_EQN, /* eqn delim option in tbl: arg */
MANDOCERR_TBLLAYOUT_MOD, /* unsupported tbl layout modifier: m */
MANDOCERR_TBLMACRO, /* ignoring macro in table: macro */
+ MANDOCERR_TBL_TMAN, /* skipping tbl in -Tman mode */
+ MANDOCERR_EQN_TMAN, /* skipping eqn in -Tman mode */
+
+ MANDOCERR_BADARG, /* ===== start of bad invocations ===== */
+
+ MANDOCERR_BADARG_BAD, /* bad argument */
+ MANDOCERR_BADARG_DUPE, /* duplicate argument */
+ MANDOCERR_BADVAL, /* does not take a value */
+ MANDOCERR_BADVAL_MISS, /* missing argument value */
+ MANDOCERR_BADVAL_BAD, /* bad argument value */
+ MANDOCERR_BADVAL_DUPE, /* duplicate argument value */
+ MANDOCERR_TAG, /* no such tag */
+ MANDOCERR_MAN_TMARKDOWN, /* -Tmarkdown unsupported for man(7) input */
+
+ MANDOCERR_SYSERR, /* ===== start of system errors ===== */
+
+ MANDOCERR_DUP,
+ MANDOCERR_EXEC,
+ MANDOCERR_FDOPEN,
+ MANDOCERR_FFLUSH,
+ MANDOCERR_FORK,
+ MANDOCERR_FSTAT,
+ MANDOCERR_GETLINE,
+ MANDOCERR_GLOB,
+ MANDOCERR_GZCLOSE,
+ MANDOCERR_GZDOPEN,
+ MANDOCERR_MKSTEMP,
+ MANDOCERR_OPEN,
+ MANDOCERR_PLEDGE,
+ MANDOCERR_READ,
+ MANDOCERR_WAIT,
+ MANDOCERR_WRITE,
MANDOCERR_MAX
};
enum mandoc_esc {
ESCAPE_ERROR = 0, /* bail! unparsable escape */
+ ESCAPE_UNSUPP, /* unsupported escape; ignore it */
ESCAPE_IGNORE, /* escape to be ignored */
+ ESCAPE_UNDEF, /* undefined escape; print literal character */
ESCAPE_SPECIAL, /* a regular special character */
ESCAPE_FONT, /* a generic font mode */
ESCAPE_FONTBOLD, /* bold font mode */
ESCAPE_FONTITALIC, /* italic font mode */
ESCAPE_FONTBI, /* bold italic font mode */
ESCAPE_FONTROMAN, /* roman font mode */
- ESCAPE_FONTCW, /* constant width font mode */
+ ESCAPE_FONTCR, /* constant width font mode */
+ ESCAPE_FONTCB, /* constant width bold font mode */
+ ESCAPE_FONTCI, /* constant width italic font mode */
ESCAPE_FONTPREV, /* previous font mode */
ESCAPE_NUMBERED, /* a numbered glyph */
ESCAPE_UNICODE, /* a unicode codepoint */
};
+enum mandoc_esc mandoc_font(const char *, int);
enum mandoc_esc mandoc_escape(const char **, const char **, int *);
void mandoc_msg_setoutfile(FILE *);
const char *mandoc_msg_getinfilename(void);
void mandoc_msg_setrc(enum mandoclevel);
void mandoc_msg(enum mandocerr, int, int, const char *, ...)
__attribute__((__format__ (__printf__, 4, 5)));
+void mandoc_msg_summary(void);
void mchars_alloc(void);
void mchars_free(void);
int mchars_num2char(const char *, size_t);