-/* $Id: mdoc.h,v 1.38 2009/03/08 11:41:22 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.54 2009/03/31 13:50:19 kristaps Exp $ */
/*
- * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
+ * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the
#ifndef MDOC_H
#define MDOC_H
+#include <time.h>
+
/*
* This library implements a validating scanner/parser for ``mdoc'' roff
* macro documents, a.k.a. BSD manual page documents. The mdoc.c file
#define MDOC_Fr 104
#define MDOC_Ud 105
#define MDOC_Lb 106
-#define MDOC_MAX 107
+#define MDOC_Ap 107
+#define MDOC_Lp 108
+#define MDOC_Lk 109
+#define MDOC_Mt 110
+#define MDOC_Brq 111
+#define MDOC_Bro 112
+#define MDOC_Brc 113
+#define MDOC__C 114
+#define MDOC_Es 115
+#define MDOC_En 116
+#define MDOC_Dx 117
+#define MDOC__Q 118
+#define MDOC_MAX 119
/* What follows is a list of ALL possible macro arguments. */
#define MDOC_Words 22
#define MDOC_Emphasis 23
#define MDOC_Symbolic 24
-#define MDOC_ARG_MAX 25
+#define MDOC_Nested 25
+#define MDOC_ARG_MAX 26
/* Warnings are either syntax or groff-compatibility. */
enum mdoc_warn {
#define MDOC_ACTED (1 << 1)
enum mdoc_type type;
enum mdoc_sec sec;
+
+ /* FIXME: union/struct this with #defines. */
struct mdoc_arg *args; /* BLOCK/ELEM */
struct mdoc_node *head; /* BLOCK */
struct mdoc_node *body; /* BLOCK */
char *string; /* TEXT */
};
-#define MDOC_IGN_SCOPE (1 << 0)
+#define MDOC_IGN_SCOPE (1 << 0) /* Ignore scope violations. */
+#define MDOC_IGN_ESCAPE (1 << 1) /* Ignore bad escape sequences. */
+#define MDOC_IGN_MACRO (1 << 2) /* Ignore unknown macros. */
/* Call-backs for parse messages. */
struct mdoc_cb {
void mdoc_free(struct mdoc *);
/* Allocate a new parser instance. */
-struct mdoc *mdoc_alloc(void *data, const struct mdoc_cb *);
+struct mdoc *mdoc_alloc(void *, int, const struct mdoc_cb *);
-/* Set parse options. */
-void mdoc_setflags(struct mdoc *, int);
+/* Gets system ready for another parse. */
+int mdoc_reset(struct mdoc *);
/* Parse a single line in a stream (boolean retval). */
int mdoc_parseln(struct mdoc *, int, char *buf);
const char *mdoc_a2lib(const char *);
const char *mdoc_a2st(const char *);
-int mdoc_isdelim(const char *);
-
__END_DECLS
#endif /*!MDOC_H*/