[BACK]Return to mdoc.h CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/mdoc.h between version 1.74 and 1.97

version 1.74, 2010/03/31 07:13:53 version 1.97, 2010/07/02 10:53:28
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>   * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 149  enum mdoct {
Line 149  enum mdoct {
         MDOC_br,          MDOC_br,
         MDOC_sp,          MDOC_sp,
         MDOC__U,          MDOC__U,
           MDOC_Ta,
         MDOC_MAX          MDOC_MAX
 };  };
   
 /* What follows is a list of ALL possible macro arguments. */  /* What follows is a list of ALL possible macro arguments. */
   
   /* FIXME: make this into an enum. */
 #define MDOC_Split       0  #define MDOC_Split       0
 #define MDOC_Nosplit     1  #define MDOC_Nosplit     1
 #define MDOC_Ragged      2  #define MDOC_Ragged      2
Line 202  enum mdoc_sec {
Line 204  enum mdoc_sec {
         SEC_SYNOPSIS,          SEC_SYNOPSIS,
         SEC_DESCRIPTION,          SEC_DESCRIPTION,
         SEC_IMPLEMENTATION,          SEC_IMPLEMENTATION,
         SEC_EXIT_STATUS,  
         SEC_RETURN_VALUES,          SEC_RETURN_VALUES,
         SEC_ENVIRONMENT,          SEC_ENVIRONMENT,
         SEC_FILES,          SEC_FILES,
           SEC_EXIT_STATUS,
         SEC_EXAMPLES,          SEC_EXAMPLES,
         SEC_DIAGNOSTICS,          SEC_DIAGNOSTICS,
         SEC_COMPATIBILITY,          SEC_COMPATIBILITY,
Line 217  enum mdoc_sec {
Line 219  enum mdoc_sec {
         SEC_CAVEATS,          SEC_CAVEATS,
         SEC_BUGS,          SEC_BUGS,
         SEC_SECURITY,          SEC_SECURITY,
         SEC_CUSTOM              /* User-defined. */          SEC_CUSTOM,             /* User-defined. */
           SEC__MAX
 };  };
   
 /* Information from prologue. */  /* Information from prologue. */
 struct  mdoc_meta {  struct  mdoc_meta {
         int               msec;          char             *msec;
         char             *vol;          char             *vol;
         char             *arch;          char             *arch;
         time_t            date;          time_t            date;
Line 246  struct  mdoc_arg {
Line 249  struct  mdoc_arg {
         unsigned int      refcnt;          unsigned int      refcnt;
 };  };
   
   enum    mdoc_endbody {
           ENDBODY_NOT = 0,
           ENDBODY_SPACE,
           ENDBODY_NOSPACE
   };
   
   enum    mdoc_list {
           LIST__NONE = 0,
           LIST_bullet,
           LIST_column,
           LIST_dash,
           LIST_diag,
           LIST_enum,
           LIST_hang,
           LIST_hyphen,
           LIST_inset,
           LIST_item,
           LIST_ohang,
           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. */  /* Node in AST. */
 struct  mdoc_node {  struct  mdoc_node {
         struct mdoc_node *parent;          struct mdoc_node *parent; /* parent AST node */
         struct mdoc_node *child;          struct mdoc_node *child; /* first child AST node */
         struct mdoc_node *next;          struct mdoc_node *next; /* sibling AST node */
         struct mdoc_node *prev;          struct mdoc_node *prev; /* prior sibling AST node */
         int               nchild;          int               nchild; /* number children */
         int               line;          int               line; /* parse line */
         int               pos;          int               pos; /* parse column */
         enum mdoct        tok;          enum mdoct        tok; /* tok or MDOC__MAX if none */
         int               flags;          int               flags;
 #define MDOC_VALID       (1 << 0)  #define MDOC_VALID       (1 << 0) /* has been validated */
 #define MDOC_ACTED       (1 << 1)  #define MDOC_ACTED       (1 << 1) /* has been acted upon */
         enum mdoc_type    type;  #define MDOC_EOS         (1 << 2) /* at sentence boundary */
         enum mdoc_sec     sec;  #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 */          struct mdoc_arg  *args;         /* BLOCK/ELEM */
 #ifdef  UGLY  
         struct mdoc_node *pending;      /* BLOCK */          struct mdoc_node *pending;      /* BLOCK */
 #endif  
         struct mdoc_node *head;         /* BLOCK */          struct mdoc_node *head;         /* BLOCK */
         struct mdoc_node *body;         /* BLOCK */          struct mdoc_node *body;         /* BLOCK */
         struct mdoc_node *tail;         /* BLOCK */          struct mdoc_node *tail;         /* BLOCK */
         char             *string;       /* TEXT */          char             *string;       /* TEXT */
           enum mdoc_endbody end;          /* BODY */
   
           union {
                   struct mdoc_bl *Bl;
                   struct mdoc_bd *Bd;
           } data;
 };  };
   
 #define MDOC_IGN_SCOPE   (1 << 0) /* Ignore scope violations. */  #define MDOC_IGN_SCOPE   (1 << 0) /* Ignore scope violations. */
 #define MDOC_IGN_ESCAPE  (1 << 1) /* Ignore bad escape sequences. */  #define MDOC_IGN_ESCAPE  (1 << 1) /* Ignore bad escape sequences. */
 #define MDOC_IGN_MACRO   (1 << 2) /* Ignore unknown macros. */  #define MDOC_IGN_MACRO   (1 << 2) /* Ignore unknown macros. */
 #define MDOC_IGN_CHARS   (1 << 3) /* Ignore disallowed chars. */  
   
 /* Call-backs for parse messages. */  
   
 struct  mdoc_cb {  
         int     (*mdoc_err)(void *, int, int, const char *);  
         int     (*mdoc_warn)(void *, int, int, const char *);  
 };  
   
 /* See mdoc.3 for documentation. */  /* See mdoc.3 for documentation. */
   
 extern  const char *const *mdoc_macronames;  extern  const char *const *mdoc_macronames;
Line 296  struct mdoc;
Line 342  struct mdoc;
 /* See mdoc.3 for documentation. */  /* See mdoc.3 for documentation. */
   
 void              mdoc_free(struct mdoc *);  void              mdoc_free(struct mdoc *);
 struct  mdoc     *mdoc_alloc(void *, int, const struct mdoc_cb *);  struct  mdoc     *mdoc_alloc(struct regset *, void *, int, mandocmsg);
 void              mdoc_reset(struct mdoc *);  void              mdoc_reset(struct mdoc *);
 int               mdoc_parseln(struct mdoc *, int, char *buf);  int               mdoc_parseln(struct mdoc *, int, char *, int);
 const struct mdoc_node *mdoc_node(const struct mdoc *);  const struct mdoc_node *mdoc_node(const struct mdoc *);
 const struct mdoc_meta *mdoc_meta(const struct mdoc *);  const struct mdoc_meta *mdoc_meta(const struct mdoc *);
 int               mdoc_endparse(struct mdoc *);  int               mdoc_endparse(struct mdoc *);

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.97

CVSweb