-/* $Id: mdoc.h,v 1.2 2008/12/15 03:13:01 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.8 2008/12/29 18:08:44 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
#ifndef MDOC_H
#define MDOC_H
-#define MDOC_LINEARG_MAX 9
+#define MDOC_LINEARG_MAX 8
#define MDOC___ 0
#define MDOC_Dd 1
#define MDOC_ARG_MAX 60
enum mdoc_err {
- ERR_SYNTAX_QUOTE,
+ ERR_SYNTAX_QUOTE, /* NOTUSED */
+ ERR_SYNTAX_UNQUOTE,
+ ERR_SYNTAX_NOPUNCT,
ERR_SYNTAX_WS,
+ ERR_SYNTAX_ARG,
+ ERR_SYNTAX_ARGFORM,
+ ERR_SYNTAX_ARGVAL,
+ ERR_SYNTAX_ARGBAD,
+ ERR_SYNTAX_ARGMANY,
ERR_MACRO_NOTSUP,
ERR_MACRO_NOTCALL,
ERR_SCOPE_BREAK,
- ERR_ARGS_GE1
+ ERR_SCOPE_NOCTX,
+ ERR_SCOPE_NONEST,
+ ERR_SEC_PROLOGUE,
+ ERR_SEC_NPROLOGUE,
+ ERR_SEC_PROLOGUE_OO,
+ ERR_SEC_PROLOGUE_REP,
+ ERR_SEC_NAME,
+ ERR_ARGS_EQ0,
+ ERR_ARGS_GE1,
+ ERR_ARGS_LE2,
+ ERR_ARGS_MANY
+};
+
+enum mdoc_att {
+ ATT_DEFAULT = 0,
+ ATT_v1,
+ ATT_v2,
+ ATT_v3,
+ ATT_v4,
+ ATT_v5,
+ ATT_v6,
+ ATT_v7,
+ ATT_32v,
+ ATT_V1,
+ ATT_V2,
+ ATT_V3,
+ ATT_V4
};
enum mdoc_warn {
WARN_SYNTAX_WS_EOLN,
WARN_SYNTAX_MACLIKE,
- WARN_ARGS_GE1
+ WARN_SYNTAX_ARGLIKE,
+ WARN_SYNTAX_QUOTED,
+ WARN_IGN_AFTER_BLK,
+ WARN_IGN_BEFORE_BLK,
+ WARN_SEC_OO,
+ WARN_ARGS_GE1,
+ WARN_ARGS_EQ0,
+ WARN_COMPAT_TROFF
};
struct mdoc_arg {
};
enum mdoc_msec {
+ MSEC_DEFAULT = 0,
MSEC_1,
MSEC_2,
MSEC_3,
MSEC_n,
MSEC_unass,
MSEC_draft,
- MSEC_paper,
- MSEC_NONE
+ MSEC_paper
};
enum mdoc_sec {
- SEC_PROLOGUE,
+ SEC_PROLOGUE = 0,
+ SEC_BODY,
SEC_NAME,
SEC_SYNOPSIS,
SEC_DESCRIPTION,
};
enum mdoc_vol {
+ VOL_DEFAULT = 0,
VOL_AMD,
VOL_IND,
VOL_KM,
VOL_PS1,
VOL_SMM,
VOL_URM,
- VOL_USD,
- VOL_DEFAULT
+ VOL_USD
};
enum mdoc_arch {
+ ARCH_DEFAULT = 0,
ARCH_alpha,
ARCH_amd64,
ARCH_amiga,
ARCH_sparc64,
ARCH_sun3,
ARCH_vax,
- ARCH_zaurus,
- ARCH_DEFAULT
+ ARCH_zaurus
};
struct mdoc_meta {
enum mdoc_msec msec;
enum mdoc_vol vol;
enum mdoc_arch arch;
- struct tm tm;
+ time_t date;
+#define META_TITLE_SZ (64)
+ char title[META_TITLE_SZ];
+#define META_OS_SZ (64)
+ char os[META_OS_SZ];
};
struct mdoc_text {
struct mdoc_node *parent;
struct mdoc_node *child;
struct mdoc_node *next;
+ struct mdoc_node *prev;
enum mdoc_type type;
union mdoc_data data;
};