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

Diff for /mandoc/man_macro.c between version 1.126 and 1.127

version 1.126, 2018/08/16 23:43:37 version 1.127, 2018/08/17 20:33:37
Line 40  static int   man_args(struct roff_man *, int,
Line 40  static int   man_args(struct roff_man *, int,
                                 int *, char *, char **);                                  int *, char *, char **);
 static  void             rew_scope(struct roff_man *, enum roff_tok);  static  void             rew_scope(struct roff_man *, enum roff_tok);
   
 const   struct man_macro __man_macros[MAN_MAX - MAN_TH] = {  static const struct man_macro man_macros[MAN_MAX - MAN_TH] = {
         { in_line_eoln, MAN_BSCOPE }, /* TH */          { in_line_eoln, MAN_BSCOPE }, /* TH */
         { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SH */          { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SH */
         { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SS */          { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SS */
Line 79  const struct man_macro __man_macros[MAN_MAX - MAN_TH] 
Line 79  const struct man_macro __man_macros[MAN_MAX - MAN_TH] 
         { blk_exp, MAN_BSCOPE }, /* MT */          { blk_exp, MAN_BSCOPE }, /* MT */
         { blk_close, MAN_BSCOPE }, /* ME */          { blk_close, MAN_BSCOPE }, /* ME */
 };  };
 const   struct man_macro *const man_macros = __man_macros - MAN_TH;  
   
   
   const struct man_macro *
   man_macro(enum roff_tok tok)
   {
           assert(tok >= MAN_TH && tok <= MAN_MAX);
           return man_macros + (tok - MAN_TH);
   }
   
 void  void
 man_unscope(struct roff_man *man, const struct roff_node *to)  man_unscope(struct roff_man *man, const struct roff_node *to)
 {  {
Line 95  man_unscope(struct roff_man *man, const struct roff_no
Line 101  man_unscope(struct roff_man *man, const struct roff_no
   
                 if (to == NULL && ! (n->flags & NODE_VALID)) {                  if (to == NULL && ! (n->flags & NODE_VALID)) {
                         if (man->flags & (MAN_BLINE | MAN_ELINE) &&                          if (man->flags & (MAN_BLINE | MAN_ELINE) &&
                             man_macros[n->tok].flags & MAN_SCOPED) {                              man_macro(n->tok)->flags & MAN_SCOPED) {
                                 mandoc_vmsg(MANDOCERR_BLK_LINE,                                  mandoc_vmsg(MANDOCERR_BLK_LINE,
                                     man->parse, n->line, n->pos,                                      man->parse, n->line, n->pos,
                                     "EOF breaks %s", roff_name[n->tok]);                                      "EOF breaks %s", roff_name[n->tok]);
Line 112  man_unscope(struct roff_man *man, const struct roff_no
Line 118  man_unscope(struct roff_man *man, const struct roff_no
                                 continue;                                  continue;
                         }                          }
                         if (n->type == ROFFT_BLOCK &&                          if (n->type == ROFFT_BLOCK &&
                             man_macros[n->tok].fp == blk_exp)                              man_macro(n->tok)->fp == blk_exp)
                                 mandoc_msg(MANDOCERR_BLK_NOEND,                                  mandoc_msg(MANDOCERR_BLK_NOEND,
                                     man->parse, n->line, n->pos,                                      man->parse, n->line, n->pos,
                                     roff_name[n->tok]);                                      roff_name[n->tok]);
Line 176  rew_scope(struct roff_man *man, enum roff_tok tok)
Line 182  rew_scope(struct roff_man *man, enum roff_tok tok)
                 }                  }
                 if (tok != MAN_SH && (n->tok == MAN_SH ||                  if (tok != MAN_SH && (n->tok == MAN_SH ||
                     (tok != MAN_SS && (n->tok == MAN_SS ||                      (tok != MAN_SS && (n->tok == MAN_SS ||
                      man_macros[n->tok].fp == blk_exp))))                       man_macro(n->tok)->fp == blk_exp))))
                         return;                          return;
                 man_unscope(man, n);                  man_unscope(man, n);
                 n = man->last;                  n = man->last;
Line 327  blk_imp(MACRO_PROT_ARGS)
Line 333  blk_imp(MACRO_PROT_ARGS)
          * For `TP', always keep the head open.           * For `TP', always keep the head open.
          */           */
   
         if (man_macros[tok].flags & MAN_SCOPED &&          if (man_macro(tok)->flags & MAN_SCOPED &&
             (tok == MAN_TP || tok == MAN_TQ || n == man->last)) {              (tok == MAN_TP || tok == MAN_TQ || n == man->last)) {
                 man->flags |= MAN_BLINE;                  man->flags |= MAN_BLINE;
                 return;                  return;
Line 365  in_line_eoln(MACRO_PROT_ARGS)
Line 371  in_line_eoln(MACRO_PROT_ARGS)
                 la = *pos;                  la = *pos;
                 if ( ! man_args(man, line, pos, buf, &p))                  if ( ! man_args(man, line, pos, buf, &p))
                         break;                          break;
                 if (man_macros[tok].flags & MAN_JOIN &&                  if (man_macro(tok)->flags & MAN_JOIN &&
                     man->last->type == ROFFT_TEXT)                      man->last->type == ROFFT_TEXT)
                         roff_word_append(man, p);                          roff_word_append(man, p);
                 else                  else
Line 387  in_line_eoln(MACRO_PROT_ARGS)
Line 393  in_line_eoln(MACRO_PROT_ARGS)
          * waiting for terms to load into our context.           * waiting for terms to load into our context.
          */           */
   
         if (n == man->last && man_macros[tok].flags & MAN_SCOPED) {          if (n == man->last && man_macro(tok)->flags & MAN_SCOPED) {
                 assert( ! (man_macros[tok].flags & MAN_NSCOPED));                  assert((man_macro(tok)->flags & MAN_NSCOPED) == 0);
                 man->flags |= MAN_ELINE;                  man->flags |= MAN_ELINE;
                 return;                  return;
         }          }

Legend:
Removed from v.1.126  
changed lines
  Added in v.1.127

CVSweb