-typedef int (*out_run)(void *, const struct mdoc *);
-typedef void (*out_free)(void *);
-
-extern char *__progname;
-
-extern void *ascii_alloc(void);
-extern void *latin1_alloc(void);
-extern void *utf8_alloc(void);
-extern int terminal_run(void *, const struct mdoc *);
-extern int tree_run(void *, const struct mdoc *);
-extern void terminal_free(void *);
-
-__dead static void version(void);
-__dead static void usage(void);
-static int foptions(int *, char *);
-static int toptions(enum outt *, char *);
-static int woptions(int *, char *);
-static int merr(void *, int, int, const char *);
-static int mwarn(void *, int, int,
- enum mdoc_warn, const char *);
-static int file(struct buf *, struct buf *,
- const char *, struct mdoc *);
-static int fdesc(struct buf *, struct buf *,
- const char *, int, struct mdoc *);
+static int moptions(enum mparset *, char *);
+static void mmsg(enum mandocerr, enum mandoclevel,
+ const char *, int, int, const char *);
+static void parse(struct curparse *, int,
+ const char *, enum mandoclevel *);
+static int toptions(struct curparse *, char *);
+static void usage(void) __attribute__((noreturn));
+static void version(void) __attribute__((noreturn));
+static int woptions(struct curparse *, char *);