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

Diff for /mandoc/man.c between version 1.55 and 1.60

version 1.55, 2010/03/27 10:04:56 version 1.60, 2010/04/08 07:53:01
Line 53  const char *const __man_merrnames[WERRMAX] = {   
Line 53  const char *const __man_merrnames[WERRMAX] = {   
         "invalid nesting of roff declarations", /* WROFFNEST */          "invalid nesting of roff declarations", /* WROFFNEST */
         "scope in roff instructions broken", /* WROFFSCOPE */          "scope in roff instructions broken", /* WROFFSCOPE */
         "document title should be uppercase", /* WTITLECASE */          "document title should be uppercase", /* WTITLECASE */
           "deprecated comment style", /* WBADCOMMENT */
 };  };
   
 const   char *const __man_macronames[MAN_MAX] = {  const   char *const __man_macronames[MAN_MAX] = {
Line 378  man_ptext(struct man *m, int line, char *buf)
Line 379  man_ptext(struct man *m, int line, char *buf)
         int              i, j;          int              i, j;
         char             sv;          char             sv;
   
           /* Ignore bogus comments. */
   
           if ('\\' == buf[0] && '.' == buf[1] && '\"' == buf[2])
                   return(man_pwarn(m, line, 0, WBADCOMMENT));
   
         /* Literal free-form text whitespace is preserved. */          /* Literal free-form text whitespace is preserved. */
   
         if (MAN_LITERAL & m->flags) {          if (MAN_LITERAL & m->flags) {
Line 478  macrowarn(struct man *m, int ln, const char *buf)
Line 484  macrowarn(struct man *m, int ln, const char *buf)
 int  int
 man_pmacro(struct man *m, int ln, char *buf)  man_pmacro(struct man *m, int ln, char *buf)
 {  {
         int              i, j, ppos, fl;          int              i, j, ppos;
         enum mant        tok;          enum mant        tok;
         char             mac[5];          char             mac[5];
         struct man_node *n;          struct man_node *n;
   
         /* Comments and empties are quickly ignored. */          /* Comments and empties are quickly ignored. */
   
         fl = m->flags;  
   
         if ('\0' == buf[1])          if ('\0' == buf[1])
                 return(1);                  return(1);
   
         i = 1;          i = 1;
   
         if (' ' == buf[i]) {          /*
            * Skip whitespace between the control character and initial
            * text.  "Whitespace" is both spaces and tabs.
            */
           if (' ' == buf[i] || '\t' == buf[i]) {
                 i++;                  i++;
                 while (buf[i] && ' ' == buf[i])                  while (buf[i] && (' ' == buf[i] || '\t' == buf[i]))
                         i++;                          i++;
                 if ('\0' == buf[i])                  if ('\0' == buf[i])
                         goto out;                          goto out;
Line 550  man_pmacro(struct man *m, int ln, char *buf)
Line 558  man_pmacro(struct man *m, int ln, char *buf)
          * Remove prior ELINE macro, as it's being clobbering by a new           * Remove prior ELINE macro, as it's being clobbering by a new
          * macro.  Note that NSCOPED macros do not close out ELINE           * macro.  Note that NSCOPED macros do not close out ELINE
          * macros---they don't print text---so we let those slip by.           * macros---they don't print text---so we let those slip by.
            * NOTE: we don't allow roff blocks (NOCLOSE) to be embedded
            * here because that would stipulate blocks as children of
            * elements!
          */           */
   
         if ( ! (MAN_NSCOPED & man_macros[tok].flags) &&          if ( ! (MAN_NSCOPED & man_macros[tok].flags) &&
Line 581  man_pmacro(struct man *m, int ln, char *buf)
Line 592  man_pmacro(struct man *m, int ln, char *buf)
                 m->flags &= ~MAN_ELINE;                  m->flags &= ~MAN_ELINE;
         }          }
   
         /* Begin recursive parse sequence. */          /*
            * Save the fact that we're in the next-line for a block.  In
            * this way, embedded roff instructions can "remember" state
            * when they exit.
            */
   
         assert(man_macros[tok].fp);          if (MAN_BLINE & m->flags)
                   m->flags |= MAN_BPLINE;
   
           /* Call to handler... */
   
           assert(man_macros[tok].fp);
         if ( ! (*man_macros[tok].fp)(m, tok, ln, ppos, &i, buf))          if ( ! (*man_macros[tok].fp)(m, tok, ln, ppos, &i, buf))
                 goto err;                  goto err;
   
Line 592  out:
Line 611  out:
         /*          /*
          * We weren't in a block-line scope when entering the           * We weren't in a block-line scope when entering the
          * above-parsed macro, so return.           * above-parsed macro, so return.
          *  
          * FIXME: this prohibits the nesting of blocks (e.g., `de' and  
          * family) within BLINE or ELINE systems.  This is annoying.  
          */           */
   
         if ( ! (MAN_BLINE & fl)) {          if ( ! (MAN_BPLINE & m->flags)) {
                 m->flags &= ~MAN_ILINE;                  m->flags &= ~MAN_ILINE;
                 return(1);                  return(1);
         }          }
           m->flags &= ~MAN_BPLINE;
   
         /*          /*
          * If we're in a block scope, then allow this macro to slip by           * If we're in a block scope, then allow this macro to slip by

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.60

CVSweb