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

Diff for /mandoc/mdoc_term.c between version 1.2 and 1.7

version 1.2, 2009/03/26 14:44:41 version 1.7, 2009/06/10 20:18:43
Line 1 
Line 1 
 /* $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>   * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
  *   *
  * 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   * purpose with or without fee is hereby granted, provided that the above
  * above copyright notice and this permission notice appear in all   * copyright notice and this permission notice appear in all copies.
  * copies.  
  *   *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE   * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL   * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR   * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  * PERFORMANCE OF THIS SOFTWARE.  
  */   */
 #include <sys/types.h>  #include <sys/types.h>
   
Line 321  static int   arg_listtype(const struct mdoc_node *);
Line 319  static int   arg_listtype(const struct mdoc_node *);
 static  int       fmt_block_vspace(struct termp *,  static  int       fmt_block_vspace(struct termp *,
                         const struct mdoc_node *,                          const struct mdoc_node *,
                         const struct mdoc_node *);                          const struct mdoc_node *);
 static  int       print_node(DECL_ARGS);  static  void      print_node(DECL_ARGS);
 static  int       print_head(struct termp *,  static  void      print_head(struct termp *,
                         const struct mdoc_meta *);                          const struct mdoc_meta *);
 static  int       print_body(DECL_ARGS);  static  void      print_body(DECL_ARGS);
 static  int       print_foot(struct termp *,  static  void      print_foot(struct termp *,
                         const struct mdoc_meta *);                          const struct mdoc_meta *);
 static  void      sanity(const struct mdoc_node *);  static  void      sanity(const struct mdoc_node *);
   
Line 334  int
Line 332  int
 mdoc_run(struct termp *p, const struct mdoc *m)  mdoc_run(struct termp *p, const struct mdoc *m)
 {  {
   
         if ( ! print_head(p, mdoc_meta(m)))          print_head(p, mdoc_meta(m));
                 return(0);          print_body(p, NULL, mdoc_meta(m), mdoc_node(m));
         if ( ! print_body(p, NULL, mdoc_meta(m), mdoc_node(m)))          print_foot(p, mdoc_meta(m));
                 return(0);          return(1);
         return(print_foot(p, mdoc_meta(m)));  
 }  }
   
   
 static int  static void
 print_body(DECL_ARGS)  print_body(DECL_ARGS)
 {  {
   
         if ( ! print_node(p, pair, meta, node))          print_node(p, pair, meta, node);
                 return(0);  
         if ( ! node->next)          if ( ! node->next)
                 return(1);                  return;
         return(print_body(p, pair, meta, node->next));          print_body(p, pair, meta, node->next);
 }  }
   
   
 static int  static void
 print_node(DECL_ARGS)  print_node(DECL_ARGS)
 {  {
         int              dochild;          int              dochild;
Line 396  print_node(DECL_ARGS)
Line 392  print_node(DECL_ARGS)
         if (MDOC_TEXT != node->type)          if (MDOC_TEXT != node->type)
                 if (termacts[node->tok].post)                  if (termacts[node->tok].post)
                         (*termacts[node->tok].post)(p, &npair, meta, node);                          (*termacts[node->tok].post)(p, &npair, meta, node);
   
         return(1);  
 }  }
   
   
 static int  static void
 print_foot(struct termp *p, const struct mdoc_meta *meta)  print_foot(struct termp *p, const struct mdoc_meta *meta)
 {  {
         struct tm       *tm;          struct tm       *tm;
Line 449  print_foot(struct termp *p, const struct mdoc_meta *me
Line 443  print_foot(struct termp *p, const struct mdoc_meta *me
   
         free(buf);          free(buf);
         free(os);          free(os);
   
         return(1);  
 }  }
   
   
 static int  static void
 print_head(struct termp *p, const struct mdoc_meta *meta)  print_head(struct termp *p, const struct mdoc_meta *meta)
 {  {
         char            *buf, *title;          char            *buf, *title;
Line 520  print_head(struct termp *p, const struct mdoc_meta *me
Line 512  print_head(struct termp *p, const struct mdoc_meta *me
   
         free(title);          free(title);
         free(buf);          free(buf);
   
         return(1);  
 }  }
   
   
Line 1435  static int
Line 1425  static int
 termp_d1_pre(DECL_ARGS)  termp_d1_pre(DECL_ARGS)
 {  {
   
         if (MDOC_BODY != node->type)          if (MDOC_BLOCK != node->type)
                 return(1);                  return(1);
         term_newln(p);          term_newln(p);
         p->offset += (pair->offset = INDENT);          p->offset += (pair->offset = INDENT);
Line 1448  static void
Line 1438  static void
 termp_d1_post(DECL_ARGS)  termp_d1_post(DECL_ARGS)
 {  {
   
         if (MDOC_BODY != node->type)          if (MDOC_BLOCK != node->type)
                 return;                  return;
         term_newln(p);          term_newln(p);
         p->offset -= pair->offset;          p->offset -= pair->offset;
Line 1850  termp_ss_pre(DECL_ARGS)
Line 1840  termp_ss_pre(DECL_ARGS)
                 break;                  break;
         case (MDOC_HEAD):          case (MDOC_HEAD):
                 TERMPAIR_SETFLAG(p, pair, ttypes[TTYPE_SSECTION]);                  TERMPAIR_SETFLAG(p, pair, ttypes[TTYPE_SSECTION]);
                 p->offset = INDENT / 2;                  p->offset = HALFINDENT;
                 break;                  break;
         default:          default:
                 break;                  break;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.7

CVSweb