=================================================================== RCS file: /cvs/docbook2mdoc/macro.h,v retrieving revision 1.3 retrieving revision 1.8 diff -u -p -r1.3 -r1.8 --- docbook2mdoc/macro.h 2019/04/06 22:37:57 1.3 +++ docbook2mdoc/macro.h 2019/05/20 20:08:26 1.8 @@ -1,4 +1,4 @@ -/* $Id: macro.h,v 1.3 2019/04/06 22:37:57 schwarze Exp $ */ +/* $Id: macro.h,v 1.8 2019/05/20 20:08:26 schwarze Exp $ */ /* * Copyright (c) 2019 Ingo Schwarze * @@ -26,27 +26,40 @@ enum linestate { LINE_MACRO /* In the middle of a macro line. */ }; +enum parastate { + PARA_HAVE, /* Just printed .Pp or equivalent. */ + PARA_MID, /* In the middle of a paragraph. */ + PARA_WANT /* Need .Pp before printing anything else. */ +}; + struct format { int level; /* Header level, starting at 1. */ - int spc; /* Whitespace before next macro. */ + int nofill; /* Level of no-fill block nesting. */ + int flags; +#define FMT_NOSPC (1 << 0) /* Suppress space before next node. */ +#define FMT_ARG (1 << 1) /* May add argument to current macro. */ +#define FMT_CHILD (1 << 2) /* Expect a single child macro. */ +#define FMT_IMPL (1 << 3) /* Partial implicit block is open. */ enum linestate linestate; + enum parastate parastate; }; -#define ARG_SPACE 1 /* Insert whitespace before this argument. */ -#define ARG_SINGLE 2 /* Quote argument if it contains whitespace. */ -#define ARG_QUOTED 4 /* We are already in a quoted argument. */ -#define ARG_UPPER 8 /* Covert argument to upper case. */ +#define ARG_SPACE (1 << 0) /* Insert whitespace before this argument. */ +#define ARG_SINGLE (1 << 1) /* Quote arg if it contains whitespace. */ +#define ARG_QUOTED (1 << 2) /* We are already in a quoted argument. */ +#define ARG_RAW (1 << 3) /* Skip macro and backslash escaping. */ +#define ARG_UPPER (1 << 4) /* Convert argument to upper case. */ void macro_open(struct format *, const char *); void macro_close(struct format *); void macro_line(struct format *, const char *); -void macro_closepunct(struct format *, struct pnode *); void macro_addarg(struct format *, const char *, int); void macro_argline(struct format *, const char *, const char *); void macro_addnode(struct format *, struct pnode *, int); void macro_nodeline(struct format *, const char *, struct pnode *, int); +void para_check(struct format *); void print_text(struct format *, const char *, int); void print_textnode(struct format *, struct pnode *);