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

Diff for /mandoc/roff.c between version 1.272 and 1.273

version 1.272, 2015/06/27 13:29:14 version 1.273, 2015/08/29 20:26:04
Line 335  struct roff {
Line 335  struct roff {
         int              rstacksz; /* current size limit of rstack */          int              rstacksz; /* current size limit of rstack */
         int              rstackpos; /* position in rstack */          int              rstackpos; /* position in rstack */
         int              format; /* current file in mdoc or man format */          int              format; /* current file in mdoc or man format */
           int              argc; /* number of args of the last macro */
         char             control; /* control character */          char             control; /* control character */
 };  };
   
Line 411  static int   roff_getnum(const char *, int *, int *, i
Line 412  static int   roff_getnum(const char *, int *, int *, i
 static  int              roff_getop(const char *, int *, char *);  static  int              roff_getop(const char *, int *, char *);
 static  int              roff_getregn(const struct roff *,  static  int              roff_getregn(const struct roff *,
                                 const char *, size_t);                                  const char *, size_t);
 static  int              roff_getregro(const char *name);  static  int              roff_getregro(const struct roff *,
                                   const char *name);
 static  const char      *roff_getstrn(const struct roff *,  static  const char      *roff_getstrn(const struct roff *,
                                 const char *, size_t);                                  const char *, size_t);
 static  int              roff_hasregn(const struct roff *,  static  int              roff_hasregn(const struct roff *,
Line 2575  roff_setreg(struct roff *r, const char *name, int val,
Line 2577  roff_setreg(struct roff *r, const char *name, int val,
  * were to turn up, another special value would have to be chosen.   * were to turn up, another special value would have to be chosen.
  */   */
 static int  static int
 roff_getregro(const char *name)  roff_getregro(const struct roff *r, const char *name)
 {  {
   
         switch (*name) {          switch (*name) {
           case '$':  /* Number of arguments of the last macro evaluated. */
                   return(r->argc);
         case 'A':  /* ASCII approximation mode is always off. */          case 'A':  /* ASCII approximation mode is always off. */
                 return(0);                  return(0);
         case 'g':  /* Groff compatibility mode is always on. */          case 'g':  /* Groff compatibility mode is always on. */
Line 2603  roff_getreg(const struct roff *r, const char *name)
Line 2607  roff_getreg(const struct roff *r, const char *name)
         int              val;          int              val;
   
         if ('.' == name[0] && '\0' != name[1] && '\0' == name[2]) {          if ('.' == name[0] && '\0' != name[1] && '\0' == name[2]) {
                 val = roff_getregro(name + 1);                  val = roff_getregro(r, name + 1);
                 if (-1 != val)                  if (-1 != val)
                         return (val);                          return (val);
         }          }
Line 2622  roff_getregn(const struct roff *r, const char *name, s
Line 2626  roff_getregn(const struct roff *r, const char *name, s
         int              val;          int              val;
   
         if ('.' == name[0] && 2 == len) {          if ('.' == name[0] && 2 == len) {
                 val = roff_getregro(name + 1);                  val = roff_getregro(r, name + 1);
                 if (-1 != val)                  if (-1 != val)
                         return (val);                          return (val);
         }          }
Line 2642  roff_hasregn(const struct roff *r, const char *name, s
Line 2646  roff_hasregn(const struct roff *r, const char *name, s
         int              val;          int              val;
   
         if ('.' == name[0] && 2 == len) {          if ('.' == name[0] && 2 == len) {
                 val = roff_getregro(name + 1);                  val = roff_getregro(r, name + 1);
                 if (-1 != val)                  if (-1 != val)
                         return(1);                          return(1);
         }          }
Line 3084  roff_userdef(ROFF_ARGS)
Line 3088  roff_userdef(ROFF_ARGS)
          * and NUL-terminate them.           * and NUL-terminate them.
          */           */
   
           r->argc = 0;
         cp = buf->buf + pos;          cp = buf->buf + pos;
         for (i = 0; i < 9; i++)          for (i = 0; i < 9; i++) {
                 arg[i] = *cp == '\0' ? "" :                  if (*cp == '\0')
                     mandoc_getarg(r->parse, &cp, ln, &pos);                          arg[i] = "";
                   else {
                           arg[i] = mandoc_getarg(r->parse, &cp, ln, &pos);
                           r->argc = i + 1;
                   }
           }
   
         /*          /*
          * Expand macro arguments.           * Expand macro arguments.

Legend:
Removed from v.1.272  
changed lines
  Added in v.1.273

CVSweb