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

Diff for /mandoc/mdoc_argv.c between version 1.109 and 1.114

version 1.109, 2016/08/28 16:15:12 version 1.114, 2017/05/05 15:17:32
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) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2012, 2014-2017 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 144  static const enum mdocargt args_Bl[] = {
Line 144  static const enum mdocargt args_Bl[] = {
         MDOC_ARG_MAX          MDOC_ARG_MAX
 };  };
   
 static  const struct mdocarg mdocargs[MDOC_MAX] = {  static  const struct mdocarg __mdocargs[MDOC_MAX - MDOC_Dd] = {
         { ARGSFL_DELIM, NULL }, /* Ap */  
         { ARGSFL_NONE, NULL }, /* Dd */          { ARGSFL_NONE, NULL }, /* Dd */
         { ARGSFL_NONE, NULL }, /* Dt */          { ARGSFL_NONE, NULL }, /* Dt */
         { ARGSFL_NONE, NULL }, /* Os */          { ARGSFL_NONE, NULL }, /* Os */
Line 161  static const struct mdocarg mdocargs[MDOC_MAX] = {
Line 160  static const struct mdocarg mdocargs[MDOC_MAX] = {
         { ARGSFL_NONE, NULL }, /* It */          { ARGSFL_NONE, NULL }, /* It */
         { ARGSFL_DELIM, NULL }, /* Ad */          { ARGSFL_DELIM, NULL }, /* Ad */
         { ARGSFL_DELIM, args_An }, /* An */          { ARGSFL_DELIM, args_An }, /* An */
           { ARGSFL_DELIM, NULL }, /* Ap */
         { ARGSFL_DELIM, NULL }, /* Ar */          { ARGSFL_DELIM, NULL }, /* Ar */
         { ARGSFL_DELIM, NULL }, /* Cd */          { ARGSFL_DELIM, NULL }, /* Cd */
         { ARGSFL_DELIM, NULL }, /* Cm */          { ARGSFL_DELIM, NULL }, /* Cm */
Line 263  static const struct mdocarg mdocargs[MDOC_MAX] = {
Line 263  static const struct mdocarg mdocargs[MDOC_MAX] = {
         { ARGSFL_DELIM, NULL }, /* En */          { ARGSFL_DELIM, NULL }, /* En */
         { ARGSFL_DELIM, NULL }, /* Dx */          { ARGSFL_DELIM, NULL }, /* Dx */
         { ARGSFL_NONE, NULL }, /* %Q */          { ARGSFL_NONE, NULL }, /* %Q */
         { ARGSFL_NONE, NULL }, /* br */  
         { ARGSFL_NONE, NULL }, /* sp */  
         { ARGSFL_NONE, NULL }, /* %U */          { ARGSFL_NONE, NULL }, /* %U */
         { ARGSFL_NONE, NULL }, /* Ta */          { ARGSFL_NONE, NULL }, /* Ta */
         { ARGSFL_NONE, NULL }, /* ll */  
 };  };
   static  const struct mdocarg *const mdocargs = __mdocargs - MDOC_Dd;
   
   
 /*  /*
Line 277  static const struct mdocarg mdocargs[MDOC_MAX] = {
Line 275  static const struct mdocarg mdocargs[MDOC_MAX] = {
  * Some flags take no argument, some one, some multiple.   * Some flags take no argument, some one, some multiple.
  */   */
 void  void
 mdoc_argv(struct roff_man *mdoc, int line, int tok,  mdoc_argv(struct roff_man *mdoc, int line, enum roff_tok tok,
         struct mdoc_arg **reta, int *pos, char *buf)          struct mdoc_arg **reta, int *pos, char *buf)
 {  {
         struct mdoc_argv          tmpv;          struct mdoc_argv          tmpv;
Line 291  mdoc_argv(struct roff_man *mdoc, int line, int tok,
Line 289  mdoc_argv(struct roff_man *mdoc, int line, int tok,
   
         /* Which flags does this macro support? */          /* Which flags does this macro support? */
   
           assert(tok >= MDOC_Dd && tok < MDOC_MAX);
         argtable = mdocargs[tok].argvs;          argtable = mdocargs[tok].argvs;
         if (argtable == NULL)          if (argtable == NULL)
                 return;                  return;
Line 415  argn_free(struct mdoc_arg *p, int iarg)
Line 414  argn_free(struct mdoc_arg *p, int iarg)
   
 enum margserr  enum margserr
 mdoc_args(struct roff_man *mdoc, int line, int *pos,  mdoc_args(struct roff_man *mdoc, int line, int *pos,
         char *buf, int tok, char **v)          char *buf, enum roff_tok tok, char **v)
 {  {
         struct roff_node *n;          struct roff_node *n;
         char             *v_local;          char             *v_local;
Line 424  mdoc_args(struct roff_man *mdoc, int line, int *pos,
Line 423  mdoc_args(struct roff_man *mdoc, int line, int *pos,
         if (v == NULL)          if (v == NULL)
                 v = &v_local;                  v = &v_local;
         fl = tok == TOKEN_NONE ? ARGSFL_NONE : mdocargs[tok].flags;          fl = tok == TOKEN_NONE ? ARGSFL_NONE : mdocargs[tok].flags;
         if (tok != MDOC_It)  
                 return args(mdoc, line, pos, buf, fl, v);  
   
         /*          /*
          * We know that we're in an `It', so it's reasonable to expect           * We know that we're in an `It', so it's reasonable to expect
Line 434  mdoc_args(struct roff_man *mdoc, int line, int *pos,
Line 431  mdoc_args(struct roff_man *mdoc, int line, int *pos,
          * safe fall-back into the default behaviour.           * safe fall-back into the default behaviour.
          */           */
   
         for (n = mdoc->last; n; n = n->parent)          if (tok == MDOC_It) {
                 if (MDOC_Bl == n->tok)                  for (n = mdoc->last; n != NULL; n = n->parent) {
                         if (LIST_column == n->norm->Bl.type) {                          if (n->tok != MDOC_Bl)
                                   continue;
                           if (n->norm->Bl.type == LIST_column)
                                 fl = ARGSFL_TABSEP;                                  fl = ARGSFL_TABSEP;
                                 break;                          break;
                         }                  }
           }
   
         return args(mdoc, line, pos, buf, fl, v);          return args(mdoc, line, pos, buf, fl, v);
 }  }

Legend:
Removed from v.1.109  
changed lines
  Added in v.1.114

CVSweb