=================================================================== RCS file: /cvs/mandoc/mandoc.h,v retrieving revision 1.265 retrieving revision 1.281 diff -u -p -r1.265 -r1.281 --- mandoc/mandoc.h 2020/01/19 16:44:50 1.265 +++ mandoc/mandoc.h 2022/08/16 17:30:11 1.281 @@ -1,7 +1,7 @@ -/* $Id: mandoc.h,v 1.265 2020/01/19 16:44:50 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.281 2022/08/16 17:30:11 schwarze Exp $ */ /* + * Copyright (c) 2012-2022 Ingo Schwarze * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons - * Copyright (c) 2012-2020 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,11 +16,15 @@ * 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 */ -#define ASCII_HYPH 30 /* breakable hyphen */ -#define ASCII_BREAK 29 /* breakable zero-width space */ +#define ASCII_NBRZW 30 /* non-breaking zero-width space */ +#define ASCII_BREAK 29 /* breakable zero-width space */ +#define ASCII_HYPH 28 /* breakable hyphen */ +#define ASCII_ESC 27 /* escape sequence from copy-in processing */ +#define ASCII_TABREF 26 /* reset tab reference position */ /* * Status level. This refers to both internal status (i.e., whilst @@ -53,7 +57,6 @@ enum mandocerr { 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 ===== */ @@ -67,10 +70,12 @@ enum mandocerr { 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 */ @@ -83,6 +88,7 @@ enum mandocerr { 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_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 */ @@ -162,13 +168,14 @@ enum mandocerr { MANDOCERR_SM_BAD, /* invalid Boolean argument: macro arg */ MANDOCERR_CHAR_FONT, /* argument contains two font escapes */ MANDOCERR_FT_BAD, /* unknown font, skipping request: ft font */ + MANDOCERR_MC_DIST, /* ignoring distance argument: mc ... arg */ MANDOCERR_TR_ODD, /* odd number of characters in request: tr char */ /* related to plain text */ MANDOCERR_FI_BLANK, /* blank line in fill mode, using .sp */ MANDOCERR_FI_TAB, /* tab in filled text */ MANDOCERR_EOS, /* new sentence, new line */ - MANDOCERR_ESC_BAD, /* invalid escape sequence: esc */ + MANDOCERR_ESC_ARG, /* invalid escape sequence argument: esc */ MANDOCERR_ESC_UNDEF, /* undefined escape, printing literally: char */ MANDOCERR_STR_UNDEF, /* undefined string, using "": name */ @@ -187,6 +194,7 @@ enum mandocerr { 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 */ @@ -211,11 +219,13 @@ enum mandocerr { MANDOCERR_NAMESC, /* escaped character not allowed in a name: name */ MANDOCERR_ARG_UNDEF, /* using macro argument outside macro */ MANDOCERR_ARG_NONUM, /* argument number is not numeric */ + MANDOCERR_ARG_NEG, /* negative argument, using 0: request arg */ MANDOCERR_BD_FILE, /* NOT IMPLEMENTED: Bd -file */ MANDOCERR_BD_NOARG, /* skipping display without arguments: Bd */ MANDOCERR_BL_NOTYPE, /* missing list type, using -item: Bl */ MANDOCERR_CE_NONUM, /* argument is not numeric, using 1: ce ... */ MANDOCERR_CHAR_ARG, /* argument is not a character: char ... */ + MANDOCERR_MC_ESC, /* skipping unusable escape sequence: mc arg */ MANDOCERR_NM_NONAME, /* missing manual name, using "": Nm */ MANDOCERR_OS_UNAME, /* uname(3) system call failed, using UNKNOWN */ MANDOCERR_ST_BAD, /* unknown standard specifier: St standard */ @@ -223,10 +233,17 @@ enum mandocerr { 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 */ + /* related to escape sequences */ + MANDOCERR_ESC_INCOMPLETE, /* incomplete escape sequence: esc */ + MANDOCERR_ESC_BADCHAR, /* invalid special character: esc */ + MANDOCERR_ESC_UNKCHAR, /* unknown special character: esc */ + MANDOCERR_ESC_DELIM, /* invalid escape argument delimiter: esc */ + MANDOCERR_UNSUPP, /* ===== start of unsupported features ===== */ MANDOCERR_TOOLARGE, /* input too large */ @@ -240,6 +257,8 @@ enum mandocerr { 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 ===== */ @@ -250,6 +269,7 @@ enum mandocerr { 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 ===== */ @@ -274,17 +294,20 @@ enum mandocerr { }; 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_EXPAND = 0, /* interpolation and iterative call needed */ + ESCAPE_ERROR, /* non-fatal error: unparsable escape */ + ESCAPE_UNSUPP, /* unsupported escape: warn and ignore */ + ESCAPE_IGNORE, /* valid escape to be ignored */ + ESCAPE_UNDEF, /* undefined escape: print literal character */ + ESCAPE_SPECIAL, /* special character escape */ 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 */ @@ -298,7 +321,7 @@ enum mandoc_esc { }; -enum mandoc_esc mandoc_font(const char *, int sz); +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);