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

Diff for /mandoc/main.c between version 1.72 and 1.76

version 1.72, 2010/05/15 18:43:59 version 1.76, 2010/05/16 10:59:36
Line 386  static void
Line 386  static void
 fdesc(struct curparse *curp)  fdesc(struct curparse *curp)
 {  {
         struct buf       ln, blk;          struct buf       ln, blk;
         int              i, pos, lnn, lnn_start, with_mmap;          int              i, pos, lnn, lnn_start, with_mmap, of;
         enum rofferr     re;          enum rofferr     re;
         struct man      *man;          struct man      *man;
         struct mdoc     *mdoc;          struct mdoc     *mdoc;
Line 467  fdesc(struct curparse *curp)
Line 467  fdesc(struct curparse *curp)
                                 goto bailout;                                  goto bailout;
                 ln.buf[pos] = '\0';                  ln.buf[pos] = '\0';
   
                 re = roff_parseln(roff, lnn_start, &ln.buf, &ln.sz);                  /*
                    * A significant amount of complexity is contained by
                    * the roff preprocessor.  It's line-oriented but can be
                    * expressed on one line, so we need at times to
                    * readjust our starting point and re-run it.  The roff
                    * preprocessor can also readjust the buffers with new
                    * data, so we pass them in wholesale.
                    */
   
                   of = 0;
                   do {
                           re = roff_parseln(roff, lnn_start,
                                           &ln.buf, &ln.sz, of, &of);
                   } while (ROFF_RERUN == re);
   
                 if (ROFF_IGN == re)                  if (ROFF_IGN == re)
                         continue;                          continue;
                 else if (ROFF_ERR == re)                  else if (ROFF_ERR == re)
                         goto bailout;                          goto bailout;
   
                 /* If unset, assign parser in pset(). */                  /*
                    * If input parsers have not been allocated, do so now.
                    * We keep these instanced betwen parsers, but set them
                    * locally per parse routine since we can use different
                    * parsers with each one.
                    */
   
                 if ( ! (man || mdoc) && ! pset(ln.buf, pos, curp, &man, &mdoc))                  if ( ! (man || mdoc))
                         goto bailout;                          if ( ! pset(ln.buf + of, pos - of, curp, &man, &mdoc))
                                   goto bailout;
   
                 /* Pass down into parsers. */                  /* Lastly, push down into the parsers themselves. */
   
                 if (man && ! man_parseln(man, lnn_start, ln.buf))                  if (man && ! man_parseln(man, lnn_start, ln.buf, of))
                         goto bailout;                          goto bailout;
                 if (mdoc && ! mdoc_parseln(mdoc, lnn_start, ln.buf))                  if (mdoc && ! mdoc_parseln(mdoc, lnn_start, ln.buf, of))
                         goto bailout;                          goto bailout;
         }          }
   
Line 493  fdesc(struct curparse *curp)
Line 513  fdesc(struct curparse *curp)
                 goto bailout;                  goto bailout;
         }          }
   
           /* Clean up the parse routine ASTs. */
   
         if (mdoc && ! mdoc_endparse(mdoc))          if (mdoc && ! mdoc_endparse(mdoc))
                 goto bailout;                  goto bailout;
         if (man && ! man_endparse(man))          if (man && ! man_endparse(man))
Line 574  pset(const char *buf, int pos, struct curparse *curp,
Line 596  pset(const char *buf, int pos, struct curparse *curp,
          * default to -man, which is more lenient.           * default to -man, which is more lenient.
          */           */
   
         if (buf[0] == '.') {          if ('.' == buf[0] || '\'' == buf[0]) {
                 for (i = 1; buf[i]; i++)                  for (i = 1; buf[i]; i++)
                         if (' ' != buf[i] && '\t' != buf[i])                          if (' ' != buf[i] && '\t' != buf[i])
                                 break;                                  break;
Line 773  mwarn(void *arg, int line, int col, const char *msg)
Line 795  mwarn(void *arg, int line, int col, const char *msg)
         return(1);          return(1);
 }  }
   
   static  const char * const      mandocerrs[MANDOCERR_MAX] = {
           "ok",
           "multi-line scope open on exit",
           "request for scope closure when no matching scope is open",
           "line arguments will be lost",
           "memory exhausted"
   };
   
 /*  /*
  * XXX: this is experimental code that will eventually become the   * XXX: this is experimental code that will eventually become the
  * generic means of covering all warnings and errors!   * generic means of covering all warnings and errors!
Line 781  mwarn(void *arg, int line, int col, const char *msg)
Line 811  mwarn(void *arg, int line, int col, const char *msg)
 static int  static int
 mmsg(enum mandocerr t, void *arg, int ln, int col, const char *msg)  mmsg(enum mandocerr t, void *arg, int ln, int col, const char *msg)
 {  {
   #if 0
         struct curparse *cp;          struct curparse *cp;
   
         cp = (struct curparse *)arg;          cp = (struct curparse *)arg;
   
         /*fprintf(stderr, "%s:%d:%d: %s\n", cp->file, ln, col + 1, msg);*/          fprintf(stderr, "%s:%d:%d: %s", cp->file,
                           ln, col + 1, mandocerrs[t]);
   
           if (msg)
                   fprintf(stderr, ": %s", msg);
   
           fputc('\n', stderr);
   #endif
         return(1);          return(1);
 }  }

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.76

CVSweb