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

Diff for /mandoc/main.c between version 1.121 and 1.122

version 1.121, 2010/12/06 16:55:35 version 1.122, 2010/12/10 20:58:56
Line 41 
Line 41 
 #define MAP_FILE        0  #define MAP_FILE        0
 #endif  #endif
   
   #define REPARSE_LIMIT   1000
 #define UNCONST(a)      ((void *)(uintptr_t)(const void *)(a))  #define UNCONST(a)      ((void *)(uintptr_t)(const void *)(a))
   
 /* FIXME: Intel's compiler?  LLVM?  pcc?  */  /* FIXME: Intel's compiler?  LLVM?  pcc?  */
Line 89  struct curparse {
Line 90  struct curparse {
         struct mdoc      *mdoc;         /* mdoc parser */          struct mdoc      *mdoc;         /* mdoc parser */
         struct roff      *roff;         /* roff parser (!NULL) */          struct roff      *roff;         /* roff parser (!NULL) */
         struct regset     regs;         /* roff registers */          struct regset     regs;         /* roff registers */
           int               reparse_count; /* finite interpolation stack */
         enum outt         outtype;      /* which output to use */          enum outt         outtype;      /* which output to use */
         out_mdoc          outmdoc;      /* mdoc output ptr */          out_mdoc          outmdoc;      /* mdoc output ptr */
         out_man           outman;       /* man output ptr */          out_man           outman;       /* man output ptr */
Line 177  static const char * const mandocerrs[MANDOCERR_MAX] = 
Line 179  static const char * const mandocerrs[MANDOCERR_MAX] = 
   
         "generic error",          "generic error",
   
           "input stack limit exceeded, infinite loop?",
         "skipping bad character",          "skipping bad character",
         "skipping text before the first section header",          "skipping text before the first section header",
         "skipping unknown macro",          "skipping unknown macro",
Line 665  parsebuf(struct curparse *curp, struct buf blk, int st
Line 668  parsebuf(struct curparse *curp, struct buf blk, int st
                 if (0 == pos && '\0' == blk.buf[i])                  if (0 == pos && '\0' == blk.buf[i])
                         break;                          break;
   
                 if (start)                  if (start) {
                         curp->line = lnn;                          curp->line = lnn;
                           curp->reparse_count = 0;
                   }
   
                 while (i < (int)blk.sz && (start || '\0' != blk.buf[i])) {                  while (i < (int)blk.sz && (start || '\0' != blk.buf[i])) {
                         if ('\n' == blk.buf[i]) {                          if ('\n' == blk.buf[i]) {
Line 765  rerun:
Line 770  rerun:
   
                 switch (rr) {                  switch (rr) {
                 case (ROFF_REPARSE):                  case (ROFF_REPARSE):
                         parsebuf(curp, ln, 0);                          if (REPARSE_LIMIT >= ++curp->reparse_count)
                                   parsebuf(curp, ln, 0);
                           else
                                   mmsg(MANDOCERR_ROFFLOOP, curp,
                                       curp->line, pos, NULL);
                         pos = 0;                          pos = 0;
                         continue;                          continue;
                 case (ROFF_APPEND):                  case (ROFF_APPEND):

Legend:
Removed from v.1.121  
changed lines
  Added in v.1.122

CVSweb