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

Diff for /mandoc/mdoc.h between version 1.22 and 1.23

version 1.22, 2009/01/15 17:38:57 version 1.23, 2009/01/16 12:23:25
Line 19 
Line 19 
 #ifndef MDOC_H  #ifndef MDOC_H
 #define MDOC_H  #define MDOC_H
   
 /* FIXME: move this elsewhere (it's 9, too). */  
   
 #define MDOC_LINEARG_MAX 12  
   
 /* What follows is a list of ALL possible macros. */  /* What follows is a list of ALL possible macros. */
   
 #define MDOC___          0  #define MDOC___          0
Line 204  enum mdoc_warn {
Line 200  enum mdoc_warn {
         WARN_COMPAT             /* Groff compat warn (at line/col). */          WARN_COMPAT             /* Groff compat warn (at line/col). */
 };  };
   
   /* Possible values for the `At' macro. */
 enum    mdoc_att {  enum    mdoc_att {
         ATT_DEFAULT = 0,          ATT_DEFAULT = 0,
         ATT_v1,          ATT_v1,
Line 220  enum mdoc_att {
Line 217  enum mdoc_att {
         ATT_V4          ATT_V4
 };  };
   
   /* An argument to a macro (multiple values = `It -column'). */
 struct  mdoc_arg {  struct  mdoc_arg {
         int               arg;          int               arg;
         int               line;          int               line;
Line 228  struct mdoc_arg {
Line 226  struct mdoc_arg {
         char            **value;          char            **value;
 };  };
   
   /*
    * Simplified grammar of syntax tree:
    *
    * MDOC_ROOT: root of tree
    * MDOC_TEXT: free-form text
    * MDOC_ELEM: elem [args] MDOC_TEXT...
    * MDOC_BLOCK, MDOC_HEAD, MDOC_BODY, MDOC_TAIL:
    *   MDOC_BLOCK:
    *     MDOC_HEAD [args] (MDOC_TEXT|MDOC_ELEM|MDOC_BLOCK)...
    *     MDOC_BODY (MDOC_TEXT|MDOC_ELEM|MDOC_BLOCK)...
    *     MDOC_TAIL (optional) (MDOC_TEXT|MDOC_ELEM|MDOC_BLOCK)...
    */
   
   /* Type of a syntax node. */
 enum    mdoc_type {  enum    mdoc_type {
         MDOC_TEXT,          MDOC_TEXT,
         MDOC_ELEM,          MDOC_ELEM,
Line 238  enum mdoc_type {
Line 250  enum mdoc_type {
         MDOC_ROOT          MDOC_ROOT
 };  };
   
   /* Manual section. */
 enum    mdoc_msec {  enum    mdoc_msec {
         MSEC_DEFAULT = 0,          MSEC_DEFAULT = 0,
         MSEC_1,          MSEC_1,
Line 260  enum mdoc_msec {
Line 273  enum mdoc_msec {
         MSEC_paper          MSEC_paper
 };  };
   
   /* Section (named/unnamed) of `Ss'. */
 enum    mdoc_sec {  enum    mdoc_sec {
         SEC_PROLOGUE = 0,          SEC_PROLOGUE = 0,
         SEC_BODY,          SEC_BODY,
Line 281  enum mdoc_sec {
Line 295  enum mdoc_sec {
         SEC_CUSTOM          SEC_CUSTOM
 };  };
   
   /* Volume of `Dt'. */
 enum    mdoc_vol {  enum    mdoc_vol {
         VOL_DEFAULT = 0,          VOL_DEFAULT = 0,
         VOL_AMD,          VOL_AMD,
Line 294  enum mdoc_vol {
Line 309  enum mdoc_vol {
         VOL_USD          VOL_USD
 };  };
   
   /* Architecture of `Dt'. */
 enum    mdoc_arch {  enum    mdoc_arch {
         ARCH_DEFAULT = 0,          ARCH_DEFAULT = 0,
         ARCH_alpha,          ARCH_alpha,
         ARCH_amd64,          ARCH_amd64,
         ARCH_amiga,          ARCH_amiga,
         ARCH_arc,          ARCH_arc,
           ARCH_arm,
         ARCH_armish,          ARCH_armish,
         ARCH_aviion,          ARCH_aviion,
         ARCH_hp300,          ARCH_hp300,
Line 323  enum mdoc_arch {
Line 340  enum mdoc_arch {
         ARCH_zaurus          ARCH_zaurus
 };  };
   
   /* Meta-information from prologue. */
 struct  mdoc_meta {  struct  mdoc_meta {
         enum mdoc_msec    msec;          enum mdoc_msec    msec;
         enum mdoc_vol     vol;          enum mdoc_vol     vol;
Line 359  union mdoc_data {
Line 377  union mdoc_data {
         struct mdoc_block block;          struct mdoc_block block;
 };  };
   
   /* Syntax node in parse tree. */
 struct  mdoc_node {  struct  mdoc_node {
         struct mdoc_node *parent;          struct mdoc_node *parent;
         struct mdoc_node *child;          struct mdoc_node *child;
Line 371  struct mdoc_node {
Line 390  struct mdoc_node {
         union mdoc_data   data;          union mdoc_data   data;
 };  };
   
   /* Call-backs for parse messages. */
 struct  mdoc_cb {  struct  mdoc_cb {
         void    (*mdoc_msg)(void *, int, int, const char *);          void    (*mdoc_msg)(void *, int, int, const char *);
         int     (*mdoc_err)(void *, int, int, const char *);          int     (*mdoc_err)(void *, int, int, const char *);
Line 385  __BEGIN_DECLS
Line 405  __BEGIN_DECLS
   
 struct  mdoc;  struct  mdoc;
   
   /* Free memory allocated with mdoc_alloc. */
 void              mdoc_free(struct mdoc *);  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 *data, const struct mdoc_cb *);
   
   /* Parse a single line (boolean retval). */
 int               mdoc_parseln(struct mdoc *, int, char *buf);  int               mdoc_parseln(struct mdoc *, int, char *buf);
 const struct mdoc_node  
                  *mdoc_result(struct mdoc *);  /* Get parse result or NULL. */
   const struct mdoc_node *mdoc_result(struct mdoc *);
   
   /* Signal end of parse sequence (boolean retval). */
 int               mdoc_endparse(struct mdoc *);  int               mdoc_endparse(struct mdoc *);
   
   /* Node type to static string. */
 char             *mdoc_type2a(enum mdoc_type);  char             *mdoc_type2a(enum mdoc_type);
   
 __END_DECLS  __END_DECLS

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

CVSweb