=================================================================== RCS file: /cvs/mandoc/mdoc.h,v retrieving revision 1.85 retrieving revision 1.98 diff -u -p -r1.85 -r1.98 --- mandoc/mdoc.h 2010/06/12 11:21:44 1.85 +++ mandoc/mdoc.h 2010/07/02 12:54:33 1.98 @@ -1,6 +1,6 @@ -/* $Id: mdoc.h,v 1.85 2010/06/12 11:21:44 kristaps Exp $ */ +/* $Id: mdoc.h,v 1.98 2010/07/02 12:54:33 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 @@ -155,6 +155,7 @@ enum mdoct { /* 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 @@ -248,6 +249,12 @@ struct mdoc_arg { unsigned int refcnt; }; +enum mdoc_endbody { + ENDBODY_NOT = 0, + ENDBODY_SPACE, + ENDBODY_NOSPACE +}; + enum mdoc_list { LIST__NONE = 0, LIST_bullet, @@ -272,12 +279,30 @@ enum mdoc_disp { DISP_literal }; +enum mdoc_font { + FONT__NONE = 0, + FONT_Em, + FONT_Li, + FONT_Sy +}; + struct mdoc_bd { - const char *offs; - enum mdoc_disp type; - int comp; + 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 */ +}; + +struct mdoc_bf { + enum mdoc_font font; /* font */ +}; + /* Node in AST. */ struct mdoc_node { struct mdoc_node *parent; /* parent AST node */ @@ -293,20 +318,23 @@ 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 */ +#define MDOC_ENDED (1 << 5) /* rendering has been ended */ 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 */ + enum mdoc_endbody end; /* BODY */ union { - enum mdoc_list list; /* `Bl' nodes */ - struct mdoc_bd Bd; + struct mdoc_bd *Bd; + struct mdoc_bf *Bf; + struct mdoc_bl *Bl; } data; }; @@ -326,7 +354,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 *);