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

Diff for /mandoc/Attic/mdoc_action.c between version 1.78 and 1.80

version 1.78, 2010/07/30 17:14:09 version 1.80, 2010/11/29 13:02:47
Line 50  struct actions {
Line 50  struct actions {
   
 static  int       concat(struct mdoc *, char *,  static  int       concat(struct mdoc *, char *,
                         const struct mdoc_node *, size_t);                          const struct mdoc_node *, size_t);
 static  inline int order_rs(enum mdoct);  
   
 static  int       post_ar(POST_ARGS);  
 static  int       post_at(POST_ARGS);  static  int       post_at(POST_ARGS);
 static  int       post_bl(POST_ARGS);  static  int       post_bl(POST_ARGS);
 static  int       post_bl_head(POST_ARGS);  static  int       post_bl_head(POST_ARGS);
Line 62  static int   post_dd(POST_ARGS);
Line 60  static int   post_dd(POST_ARGS);
 static  int       post_display(POST_ARGS);  static  int       post_display(POST_ARGS);
 static  int       post_dt(POST_ARGS);  static  int       post_dt(POST_ARGS);
 static  int       post_lb(POST_ARGS);  static  int       post_lb(POST_ARGS);
 static  int       post_li(POST_ARGS);  
 static  int       post_nm(POST_ARGS);  static  int       post_nm(POST_ARGS);
 static  int       post_os(POST_ARGS);  static  int       post_os(POST_ARGS);
 static  int       post_pa(POST_ARGS);  static  int       post_pa(POST_ARGS);
 static  int       post_prol(POST_ARGS);  static  int       post_prol(POST_ARGS);
 static  int       post_rs(POST_ARGS);  
 static  int       post_sh(POST_ARGS);  static  int       post_sh(POST_ARGS);
 static  int       post_st(POST_ARGS);  static  int       post_st(POST_ARGS);
 static  int       post_std(POST_ARGS);  static  int       post_std(POST_ARGS);
Line 92  static const struct actions mdoc_actions[MDOC_MAX] = {
Line 88  static const struct actions mdoc_actions[MDOC_MAX] = {
         { NULL, NULL }, /* It */          { NULL, NULL }, /* It */
         { NULL, NULL }, /* Ad */          { NULL, NULL }, /* Ad */
         { NULL, NULL }, /* An */          { NULL, NULL }, /* An */
         { NULL, post_ar }, /* Ar */          { NULL, NULL }, /* Ar */
         { NULL, NULL }, /* Cd */          { NULL, NULL }, /* Cd */
         { NULL, NULL }, /* Cm */          { NULL, NULL }, /* Cm */
         { NULL, NULL }, /* Dv */          { NULL, NULL }, /* Dv */
Line 106  static const struct actions mdoc_actions[MDOC_MAX] = {
Line 102  static const struct actions mdoc_actions[MDOC_MAX] = {
         { NULL, NULL }, /* Ft */          { NULL, NULL }, /* Ft */
         { NULL, NULL }, /* Ic */          { NULL, NULL }, /* Ic */
         { NULL, NULL }, /* In */          { NULL, NULL }, /* In */
         { NULL, post_li }, /* Li */          { NULL, NULL }, /* Li */
         { NULL, NULL }, /* Nd */          { NULL, NULL }, /* Nd */
         { NULL, post_nm }, /* Nm */          { NULL, post_nm }, /* Nm */
         { NULL, NULL }, /* Op */          { NULL, NULL }, /* Op */
Line 161  static const struct actions mdoc_actions[MDOC_MAX] = {
Line 157  static const struct actions mdoc_actions[MDOC_MAX] = {
         { NULL, NULL }, /* Qo */          { NULL, NULL }, /* Qo */
         { NULL, NULL }, /* Qq */          { NULL, NULL }, /* Qq */
         { NULL, NULL }, /* Re */          { NULL, NULL }, /* Re */
         { NULL, post_rs }, /* Rs */          { NULL, NULL }, /* Rs */
         { NULL, NULL }, /* Sc */          { NULL, NULL }, /* Sc */
         { NULL, NULL }, /* So */          { NULL, NULL }, /* So */
         { NULL, NULL }, /* Sq */          { NULL, NULL }, /* Sq */
Line 859  post_pa(POST_ARGS)
Line 855  post_pa(POST_ARGS)
   
   
 /*  /*
  * Empty `Li' macros get an empty string to make front-ends add an extra  
  * space.  
  */  
 static int  
 post_li(POST_ARGS)  
 {  
         struct mdoc_node *np;  
   
         if (n->child)  
                 return(1);  
   
         np = n;  
         m->next = MDOC_NEXT_CHILD;  
         if ( ! mdoc_word_alloc(m, n->line, n->pos, ""))  
                 return(0);  
         m->last = np;  
         return(1);  
 }  
   
   
 /*  
  * The `Ar' macro defaults to two strings "file ..." if no value is  
  * provided as an argument.  
  */  
 static int  
 post_ar(POST_ARGS)  
 {  
         struct mdoc_node *np;  
   
         if (n->child)  
                 return(1);  
   
         np = n;  
         m->next = MDOC_NEXT_CHILD;  
         /* XXX: make into macro values. */  
         if ( ! mdoc_word_alloc(m, n->line, n->pos, "file"))  
                 return(0);  
         if ( ! mdoc_word_alloc(m, n->line, n->pos, "..."))  
                 return(0);  
         m->last = np;  
         return(1);  
 }  
   
   
 /*  
  * Parse the date field in `Dd'.   * Parse the date field in `Dd'.
  */   */
 static int  static int
Line 984  post_display(POST_ARGS)
Line 935  post_display(POST_ARGS)
   
         if (MDOC_BODY == n->type)          if (MDOC_BODY == n->type)
                 m->flags &= ~MDOC_LITERAL;                  m->flags &= ~MDOC_LITERAL;
         return(1);  
 }  
   
   
 static inline int  
 order_rs(enum mdoct t)  
 {  
         int             i;  
   
         for (i = 0; i < (int)RSORD_MAX; i++)  
                 if (rsord[i] == t)  
                         return(i);  
   
         abort();  
         /* NOTREACHED */  
 }  
   
   
 /* ARGSUSED */  
 static int  
 post_rs(POST_ARGS)  
 {  
         struct mdoc_node        *nn, *next, *prev;  
         int                      o;  
   
         if (MDOC_BLOCK != n->type)  
                 return(1);  
   
         assert(n->body->child);  
         for (next = NULL, nn = n->body->child->next; nn; nn = next) {  
                 o = order_rs(nn->tok);  
   
                 /* Remove `nn' from the chain. */  
                 next = nn->next;  
                 if (next)  
                         next->prev = nn->prev;  
   
                 prev = nn->prev;  
                 if (prev)  
                         prev->next = nn->next;  
   
                 nn->prev = nn->next = NULL;  
   
                 /*  
                  * Scan back until we reach a node that's ordered before  
                  * us, then set ourselves as being the next.  
                  */  
                 for ( ; prev; prev = prev->prev)  
                         if (order_rs(prev->tok) <= o)  
                                 break;  
   
                 nn->prev = prev;  
                 if (prev) {  
                         if (prev->next)  
                                 prev->next->prev = nn;  
                         nn->next = prev->next;  
                         prev->next = nn;  
                         continue;  
                 }  
   
                 n->body->child->prev = nn;  
                 nn->next = n->body->child;  
                 n->body->child = nn;  
         }  
         return(1);          return(1);
 }  }

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.80

CVSweb