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

Diff for /mandoc/Attic/man_action.c between version 1.25 and 1.32

version 1.25, 2010/01/01 17:14:27 version 1.32, 2010/05/15 16:27:23
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 18 
Line 18 
 #include "config.h"  #include "config.h"
 #endif  #endif
   
 #include <sys/utsname.h>  
   
 #include <assert.h>  #include <assert.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 32  struct actions {
Line 30  struct actions {
 };  };
   
 static  int       post_TH(struct man *);  static  int       post_TH(struct man *);
   static  int       post_de(struct man *);
 static  int       post_fi(struct man *);  static  int       post_fi(struct man *);
 static  int       post_nf(struct man *);  static  int       post_nf(struct man *);
   
Line 68  const struct actions man_actions[MAN_MAX] = {
Line 67  const struct actions man_actions[MAN_MAX] = {
         { NULL }, /* DT */          { NULL }, /* DT */
         { NULL }, /* UC */          { NULL }, /* UC */
         { NULL }, /* PD */          { NULL }, /* PD */
           { NULL }, /* Sp */
           { post_nf }, /* Vb */
           { post_fi }, /* Ve */
           { post_de }, /* de */
           { post_de }, /* dei */
           { post_de }, /* am */
           { post_de }, /* ami */
           { post_de }, /* ig */
           { NULL }, /* . */
 };  };
   
   
Line 107  post_fi(struct man *m)
Line 115  post_fi(struct man *m)
   
   
 static int  static int
   post_de(struct man *m)
   {
   
           /*
            * XXX: for the time being, we indiscriminately remove roff
            * instructions from the parse stream.
            */
           if (MAN_BLOCK == m->last->type)
                   man_node_delete(m, m->last);
           return(1);
   }
   
   
   static int
 post_nf(struct man *m)  post_nf(struct man *m)
 {  {
   
Line 122  static int
Line 144  static int
 post_TH(struct man *m)  post_TH(struct man *m)
 {  {
         struct man_node *n;          struct man_node *n;
         char            *ep;  
         long             lval;  
   
         if (m->meta.title)          if (m->meta.title)
                 free(m->meta.title);                  free(m->meta.title);
Line 131  post_TH(struct man *m)
Line 151  post_TH(struct man *m)
                 free(m->meta.vol);                  free(m->meta.vol);
         if (m->meta.source)          if (m->meta.source)
                 free(m->meta.source);                  free(m->meta.source);
           if (m->meta.msec)
                   free(m->meta.msec);
   
         m->meta.title = m->meta.vol = m->meta.source = NULL;          m->meta.title = m->meta.vol =
         m->meta.msec = 0;                  m->meta.msec = m->meta.source = NULL;
         m->meta.date = 0;          m->meta.date = 0;
   
         /* ->TITLE<- MSEC DATE SOURCE VOL */          /* ->TITLE<- MSEC DATE SOURCE VOL */
Line 146  post_TH(struct man *m)
Line 168  post_TH(struct man *m)
   
         n = n->next;          n = n->next;
         assert(n);          assert(n);
           m->meta.msec = mandoc_strdup(n->string);
   
         lval = strtol(n->string, &ep, 10);  
         if (n->string[0] != '\0' && *ep == '\0')  
                 m->meta.msec = (int)lval;  
         else if ( ! man_nwarn(m, n, WMSEC))  
                 return(0);  
   
         /* TITLE MSEC ->DATE<- SOURCE VOL */          /* TITLE MSEC ->DATE<- SOURCE VOL */
   
         n = n->next;          n = n->next;
         if (n) {          if (n) {
                 m->meta.date = mandoc_a2time                  m->meta.date = mandoc_a2time
                         (MTIME_ISO_8601, n->string);                          (MTIME_ISO_8601, n->string);
   
                 if (0 == m->meta.date) {                  if (0 == m->meta.date) {
                         if ( ! man_nwarn(m, n, WDATE))                          if ( ! man_nwarn(m, n, WDATE))
                                 return(0);                                  return(0);
Line 178  post_TH(struct man *m)
Line 194  post_TH(struct man *m)
         if (n && (n = n->next))          if (n && (n = n->next))
                 m->meta.vol = mandoc_strdup(n->string);                  m->meta.vol = mandoc_strdup(n->string);
   
         /*          /*
          * The end document shouldn't have the prologue macros as part           * Remove the `TH' node after we've processed it for our
          * of the syntax tree (they encompass only meta-data).           * meta-data.
          */           */
           man_node_delete(m, m->last);
         if (m->last->parent->child == m->last) {  
                 m->last->parent->child = NULL;  
                 n = m->last;  
                 m->last = m->last->parent;  
                 m->next = MAN_NEXT_CHILD;  
         } else {  
                 assert(m->last->prev);  
                 m->last->prev->next = NULL;  
                 n = m->last;  
                 m->last = m->last->prev;  
                 m->next = MAN_NEXT_SIBLING;  
         }  
   
         man_node_freelist(n);  
         return(1);          return(1);
 }  }

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.32

CVSweb