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

Diff for /mandoc/mdoc.c between version 1.196 and 1.202

version 1.196, 2011/09/30 00:13:28 version 1.202, 2012/11/16 13:40:36
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010, 2012 Ingo Schwarze <schwarze@openbsd.org>
  *   *
  * 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 197  mdoc_free(struct mdoc *mdoc)
Line 197  mdoc_free(struct mdoc *mdoc)
  * Allocate volatile and non-volatile parse resources.   * Allocate volatile and non-volatile parse resources.
  */   */
 struct mdoc *  struct mdoc *
 mdoc_alloc(struct roff *roff, struct mparse *parse)  mdoc_alloc(struct roff *roff, struct mparse *parse, char *defos)
 {  {
         struct mdoc     *p;          struct mdoc     *p;
   
         p = mandoc_calloc(1, sizeof(struct mdoc));          p = mandoc_calloc(1, sizeof(struct mdoc));
   
         p->parse = parse;          p->parse = parse;
           p->defos = defos;
         p->roff = roff;          p->roff = roff;
   
         mdoc_hash_init();          mdoc_hash_init();
Line 301  mdoc_parseln(struct mdoc *m, int ln, char *buf, int of
Line 302  mdoc_parseln(struct mdoc *m, int ln, char *buf, int of
                         m->flags &= ~MDOC_SYNOPSIS;                          m->flags &= ~MDOC_SYNOPSIS;
         }          }
   
         return(mandoc_getcontrol(buf, &offs) ?          return(roff_getcontrol(m->roff, buf, &offs) ?
                         mdoc_pmacro(m, ln, buf, offs) :                          mdoc_pmacro(m, ln, buf, offs) :
                         mdoc_ptext(m, ln, buf, offs));                          mdoc_ptext(m, ln, buf, offs));
 }  }
Line 374  node_append(struct mdoc *mdoc, struct mdoc_node *p)
Line 375  node_append(struct mdoc *mdoc, struct mdoc_node *p)
   
         switch (p->type) {          switch (p->type) {
         case (MDOC_BODY):          case (MDOC_BODY):
                   if (ENDBODY_NOT != p->end)
                           break;
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (MDOC_TAIL):          case (MDOC_TAIL):
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
Line 500  mdoc_endbody_alloc(struct mdoc *m, int line, int pos, 
Line 503  mdoc_endbody_alloc(struct mdoc *m, int line, int pos, 
   
         p = node_alloc(m, line, pos, tok, MDOC_BODY);          p = node_alloc(m, line, pos, tok, MDOC_BODY);
         p->pending = body;          p->pending = body;
           p->norm = body->norm;
         p->end = end;          p->end = end;
         if ( ! node_append(m, p))          if ( ! node_append(m, p))
                 return(0);                  return(0);
Line 647  mdoc_node_delete(struct mdoc *m, struct mdoc_node *p)
Line 651  mdoc_node_delete(struct mdoc *m, struct mdoc_node *p)
         mdoc_node_free(p);          mdoc_node_free(p);
 }  }
   
   int
   mdoc_node_relink(struct mdoc *m, struct mdoc_node *p)
   {
   
           mdoc_node_unlink(m, p);
           return(node_append(m, p));
   }
   
 #if 0  #if 0
 /*  /*
  * Pre-treat a text line.   * Pre-treat a text line.
Line 800  mdoc_ptext(struct mdoc *m, int line, char *buf, int of
Line 812  mdoc_ptext(struct mdoc *m, int line, char *buf, int of
                         return(0);                          return(0);
   
                 m->next = MDOC_NEXT_SIBLING;                  m->next = MDOC_NEXT_SIBLING;
                 return(1);  
                   return(mdoc_valid_post(m));
         }          }
   
         if ( ! mdoc_word_alloc(m, line, offs, buf+offs))          if ( ! mdoc_word_alloc(m, line, offs, buf+offs))
Line 980  mdoc_isdelim(const char *p)
Line 993  mdoc_isdelim(const char *p)
   
         if (0 == strcmp(p + 1, "."))          if (0 == strcmp(p + 1, "."))
                 return(DELIM_CLOSE);                  return(DELIM_CLOSE);
         if (0 == strcmp(p + 1, "*(Ba"))          if (0 == strcmp(p + 1, "fR|\\fP"))
                 return(DELIM_MIDDLE);                  return(DELIM_MIDDLE);
   
         return(DELIM_NONE);          return(DELIM_NONE);

Legend:
Removed from v.1.196  
changed lines
  Added in v.1.202

CVSweb