=================================================================== RCS file: /cvs/mandoc/mdoc.h,v retrieving revision 1.82 retrieving revision 1.94 diff -u -p -r1.82 -r1.94 --- mandoc/mdoc.h 2010/05/17 23:57:06 1.82 +++ mandoc/mdoc.h 2010/06/27 16:18:13 1.94 @@ -1,6 +1,6 @@ -/* $Id: mdoc.h,v 1.82 2010/05/17 23:57:06 kristaps Exp $ */ +/* $Id: mdoc.h,v 1.94 2010/06/27 16:18:13 kristaps Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -149,11 +149,13 @@ enum mdoct { MDOC_br, MDOC_sp, MDOC__U, + MDOC_Ta, MDOC_MAX }; /* What follows is a list of ALL possible macro arguments. */ +/* FIXME: make this into an enum. */ #define MDOC_Split 0 #define MDOC_Nosplit 1 #define MDOC_Ragged 2 @@ -262,6 +264,28 @@ enum mdoc_list { LIST_tag }; +enum mdoc_disp { + DISP__NONE = 0, + DISP_centred, + DISP_ragged, + DISP_unfilled, + DISP_filled, + DISP_literal +}; + +struct mdoc_bd { + const char *offs; /* -offset */ + enum mdoc_disp type; /* -ragged, etc. */ + int comp; /* -compact */ +}; + +struct mdoc_bl { + const char *width; /* -width */ + const char *offs; /* -offset */ + enum mdoc_list type; /* -tag, -enum, etc. */ + int comp; /* -compact */ +}; + /* Node in AST. */ struct mdoc_node { struct mdoc_node *parent; /* parent AST node */ @@ -277,19 +301,20 @@ struct mdoc_node { #define MDOC_ACTED (1 << 1) /* has been acted upon */ #define MDOC_EOS (1 << 2) /* at sentence boundary */ #define MDOC_LINE (1 << 3) /* first macro/text on line */ +#define MDOC_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting */ enum mdoc_type type; /* AST node type */ enum mdoc_sec sec; /* current named section */ + /* FIXME: these can be union'd to shave a few bytes. */ struct mdoc_arg *args; /* BLOCK/ELEM */ -#ifdef UGLY struct mdoc_node *pending; /* BLOCK */ -#endif struct mdoc_node *head; /* BLOCK */ struct mdoc_node *body; /* BLOCK */ struct mdoc_node *tail; /* BLOCK */ char *string; /* TEXT */ union { - enum mdoc_list list; /* for `Bl' nodes */ + struct mdoc_bl Bl; + struct mdoc_bd Bd; } data; }; @@ -309,7 +334,7 @@ struct mdoc; /* See mdoc.3 for documentation. */ void mdoc_free(struct mdoc *); -struct mdoc *mdoc_alloc(void *, int, mandocmsg); +struct mdoc *mdoc_alloc(struct regset *, void *, int, mandocmsg); void mdoc_reset(struct mdoc *); int mdoc_parseln(struct mdoc *, int, char *, int); const struct mdoc_node *mdoc_node(const struct mdoc *);