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

Diff for /mandoc/Attic/html4_strict.c between version 1.3 and 1.4

version 1.3, 2008/11/23 22:30:53 version 1.4, 2008/11/23 23:12:47
Line 39  enum rofftype { 
Line 39  enum rofftype { 
         ROFF_LAYOUT          ROFF_LAYOUT
 };  };
   
 #define ROFFCALL_ARGS     const struct md_args *arg,            \  #define ROFFCALL_ARGS                                           \
                           struct md_mbuf *out,                  \          const struct md_args *arg, struct md_mbuf *out,         \
                           const struct md_rbuf *in,             \          const struct md_rbuf *in, const char *buf, size_t sz,   \
                           const char *buf, size_t sz,           \          size_t pos, enum roffd type, struct rofftree *tree
                           size_t pos, enum roffd type,          \  
                           struct rofftree *tree  
   
 struct  rofftree;  struct  rofftree;
   
Line 54  struct rofftok {
Line 52  struct rofftok {
         int             (*cb)(ROFFCALL_ARGS);          int             (*cb)(ROFFCALL_ARGS);
         enum rofftype     type;          enum rofftype     type;
         int               flags;          int               flags;
 #define ROFF_NESTED      (1 << 0) /* FIXME: test. */  #define ROFF_NESTED      (1 << 0)
 #define ROFF_PARSED      (1 << 1) /* FIXME: test. */  #define ROFF_PARSED      (1 << 1)
 #define ROFF_CALLABLE    (1 << 2) /* FIXME: test. */  #define ROFF_CALLABLE    (1 << 2)
 };  };
   
 struct  roffnode {  struct  roffnode {
Line 286  roffparse(const struct md_args *args, struct md_mbuf *
Line 284  roffparse(const struct md_args *args, struct md_mbuf *
                         break;                          break;
                 }                  }
                 assert(ROFF_PRELUDE & tree->state);                  assert(ROFF_PRELUDE & tree->state);
                 warnx("%s: text token `%s' in prelude (line %zu)",                  warnx("%s: body token `%s' in prelude (line %zu)",
                                 in->name, tokens[tokid].name, in->line);                                  in->name, tokens[tokid].name, in->line);
                 return(0);                  return(0);
         default:          case (ROFF_COMMENT):
                 return(1);                  return(1);
           default:
                   abort();
         }          }
   
         /*          /*
Line 411  roffnode_free(int tokid, struct rofftree *tree)
Line 411  roffnode_free(int tokid, struct rofftree *tree)
 }  }
   
   
 static int dbg_lvl = 0; /* FIXME: de-globalise. */  static int dbg_lvl = 0;
   
   
 static void  static void
 dbg_enter(const struct md_args *args, int tokid)  dbg_enter(const struct md_args *args, int tokid)
 {  {
         int              i;          int              i;
           static char      buf[72];
   
         assert(args);          assert(args);
         if ( ! (args->dbg & MD_DBG_TREE))          if ( ! (args->dbg & MD_DBG_TREE))
                 return;                  return;
   
         assert(tokid >= 0 && tokid <= ROFF_Max);          assert(tokid >= 0 && tokid <= ROFF_Max);
   
           buf[0] = 0;
   
           switch (tokens[tokid].type) {
           case (ROFF_LAYOUT):
                   /* FALLTHROUGH */
           case (ROFF_TEXT):
                   (void)strlcat(buf, "body: ", sizeof(buf));
                   break;
           case (ROFF_TITLE):
                   (void)strlcat(buf, "prelude: ", sizeof(buf));
                   break;
           default:
                   abort();
           }
   
         /* LINTED */          /* LINTED */
         for (i = 0; i < dbg_lvl; i++)          for (i = 0; i < dbg_lvl; i++)
                 (void)printf("    ");                  (void)strlcat(buf, "  ", sizeof(buf));
   
         (void)printf("%s\n", tokens[tokid].name);          (void)strlcat(buf, tokens[tokid].name, sizeof(buf));
   
           (void)printf("%s\n", buf);
   
         if (ROFF_LAYOUT == tokens[tokid].type)          if (ROFF_LAYOUT == tokens[tokid].type)
                 dbg_lvl++;                  dbg_lvl++;
 }  }
Line 439  dbg_enter(const struct md_args *args, int tokid)
Line 456  dbg_enter(const struct md_args *args, int tokid)
 static void  static void
 dbg_leave(const struct md_args *args, int tokid)  dbg_leave(const struct md_args *args, int tokid)
 {  {
         int              i;  
   
         assert(args);          assert(args);
         if ( ! (args->dbg & MD_DBG_TREE))          if ( ! (args->dbg & MD_DBG_TREE))
                 return;                  return;
Line 449  dbg_leave(const struct md_args *args, int tokid)
Line 464  dbg_leave(const struct md_args *args, int tokid)
   
         assert(tokid >= 0 && tokid <= ROFF_Max);          assert(tokid >= 0 && tokid <= ROFF_Max);
         assert(dbg_lvl > 0);          assert(dbg_lvl > 0);
   
         dbg_lvl--;          dbg_lvl--;
   
         /* LINTED */  
         for (i = 0; i < dbg_lvl; i++)  
                 (void)printf("    ");  
   
         (void)printf("%s\n", tokens[tokid].name);  
 }  }
   
   
Line 467  roff_Dd(ROFFCALL_ARGS)
Line 475  roff_Dd(ROFFCALL_ARGS)
         assert(ROFF_PRELUDE & tree->state);          assert(ROFF_PRELUDE & tree->state);
         if (ROFF_PRELUDE_Dt & tree->state ||          if (ROFF_PRELUDE_Dt & tree->state ||
                         ROFF_PRELUDE_Dd & tree->state) {                          ROFF_PRELUDE_Dd & tree->state) {
                 warnx("%s: bad prelude ordering (line %zu)",                  warnx("%s: prelude `Dd' out-of-order (line %zu)",
                                 in->name, in->line);                                  in->name, in->line);
                 return(0);                  return(0);
         }          }
Line 487  roff_Dt(ROFFCALL_ARGS)
Line 495  roff_Dt(ROFFCALL_ARGS)
         assert(ROFF_PRELUDE & tree->state);          assert(ROFF_PRELUDE & tree->state);
         if ( ! (ROFF_PRELUDE_Dd & tree->state) ||          if ( ! (ROFF_PRELUDE_Dd & tree->state) ||
                         (ROFF_PRELUDE_Dt & tree->state)) {                          (ROFF_PRELUDE_Dt & tree->state)) {
                 warnx("%s: bad prelude ordering (line %zu)",                  warnx("%s: prelude `Dt' out-of-order (line %zu)",
                                 in->name, in->line);                                  in->name, in->line);
                 return(0);                  return(0);
         }          }
Line 513  roff_Os(ROFFCALL_ARGS)
Line 521  roff_Os(ROFFCALL_ARGS)
         assert(ROFF_PRELUDE & tree->state);          assert(ROFF_PRELUDE & tree->state);
         if ( ! (ROFF_PRELUDE_Dt & tree->state) ||          if ( ! (ROFF_PRELUDE_Dt & tree->state) ||
                         ! (ROFF_PRELUDE_Dd & tree->state)) {                          ! (ROFF_PRELUDE_Dd & tree->state)) {
                 warnx("%s: bad prelude ordering (line %zu)",                  warnx("%s: prelude `Os' out-of-order (line %zu)",
                                 in->name, in->line);                                  in->name, in->line);
                 return(0);                  return(0);
         }          }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

CVSweb