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

Diff for /mandoc/mdoc_validate.c between version 1.11 and 1.12

version 1.11, 2009/06/17 09:41:00 version 1.12, 2009/06/17 10:53:32
Line 42  enum merr {
Line 42  enum merr {
         ELISTTYPE,          ELISTTYPE,
         EDISPTYPE,          EDISPTYPE,
         EMULTIDISP,          EMULTIDISP,
           ESECNAME,
         EMULTILIST,          EMULTILIST,
         EARGREP,          EARGREP,
         EBOOL,          EBOOL,
Line 116  static int pre_fd(PRE_ARGS);
Line 117  static int pre_fd(PRE_ARGS);
 static  int     pre_it(PRE_ARGS);  static  int     pre_it(PRE_ARGS);
 static  int     pre_lb(PRE_ARGS);  static  int     pre_lb(PRE_ARGS);
 static  int     pre_os(PRE_ARGS);  static  int     pre_os(PRE_ARGS);
 static  int     pre_prologue(PRE_ARGS);  
 static  int     pre_rv(PRE_ARGS);  static  int     pre_rv(PRE_ARGS);
 static  int     pre_sh(PRE_ARGS);  static  int     pre_sh(PRE_ARGS);
 static  int     pre_ss(PRE_ARGS);  static  int     pre_ss(PRE_ARGS);
Line 155  static v_pre pres_an[] = { pre_an, NULL };
Line 155  static v_pre pres_an[] = { pre_an, NULL };
 static  v_pre   pres_bd[] = { pre_display, pre_bd, NULL };  static  v_pre   pres_bd[] = { pre_display, pre_bd, NULL };
 static  v_pre   pres_bl[] = { pre_bl, NULL };  static  v_pre   pres_bl[] = { pre_bl, NULL };
 static  v_pre   pres_cd[] = { pre_cd, NULL };  static  v_pre   pres_cd[] = { pre_cd, NULL };
 static  v_pre   pres_dd[] = { pre_prologue, pre_dd, NULL };  static  v_pre   pres_dd[] = { pre_dd, NULL };
 static  v_pre   pres_d1[] = { pre_display, NULL };  static  v_pre   pres_d1[] = { pre_display, NULL };
 static  v_pre   pres_dt[] = { pre_prologue, pre_dt, NULL };  static  v_pre   pres_dt[] = { pre_dt, NULL };
 static  v_pre   pres_er[] = { pre_er, NULL };  static  v_pre   pres_er[] = { pre_er, NULL };
 static  v_pre   pres_ex[] = { pre_ex, NULL };  static  v_pre   pres_ex[] = { pre_ex, NULL };
 static  v_pre   pres_fd[] = { pre_fd, NULL };  static  v_pre   pres_fd[] = { pre_fd, NULL };
 static  v_pre   pres_it[] = { pre_it, NULL };  static  v_pre   pres_it[] = { pre_it, NULL };
 static  v_pre   pres_lb[] = { pre_lb, NULL };  static  v_pre   pres_lb[] = { pre_lb, NULL };
 static  v_pre   pres_os[] = { pre_prologue, pre_os, NULL };  static  v_pre   pres_os[] = { pre_os, NULL };
 static  v_pre   pres_rv[] = { pre_rv, NULL };  static  v_pre   pres_rv[] = { pre_rv, NULL };
 static  v_pre   pres_sh[] = { pre_sh, NULL };  static  v_pre   pres_sh[] = { pre_sh, NULL };
 static  v_pre   pres_ss[] = { pre_ss, NULL };  static  v_pre   pres_ss[] = { pre_ss, NULL };
Line 413  perr(struct mdoc *m, int line, int pos, enum merr type
Line 413  perr(struct mdoc *m, int line, int pos, enum merr type
         case (EDISPTYPE):          case (EDISPTYPE):
                 p = "missing display type";                  p = "missing display type";
                 break;                  break;
           case (ESECNAME):
                   p = "the NAME section must come first";
                   break;
         case (ELINE):          case (ELINE):
                 p = "expected line arguments";                  p = "expected line arguments";
                 break;                  break;
Line 1019  pre_cd(PRE_ARGS)
Line 1022  pre_cd(PRE_ARGS)
   
   
 static int  static int
 pre_prologue(PRE_ARGS)  
 {  
   
         return(check_sec(mdoc, n, SEC_PROLOGUE, SEC_CUSTOM));  
 }  
   
   
 static int  
 pre_dt(PRE_ARGS)  pre_dt(PRE_ARGS)
 {  {
   
Line 1077  post_bf(POST_ARGS)
Line 1072  post_bf(POST_ARGS)
         if (MDOC_BLOCK != mdoc->last->type)          if (MDOC_BLOCK != mdoc->last->type)
                 return(1);                  return(1);
   
           /* FIXME: clean-up .*/
   
         head = mdoc->last->head;          head = mdoc->last->head;
   
           if (mdoc->last->args && head->child)
   
         if (NULL == mdoc->last->args) {          if (NULL == mdoc->last->args) {
                 if (NULL == head->child ||                  if (NULL == head->child ||
                                 MDOC_TEXT != head->child->type)                                  MDOC_TEXT != head->child->type)
Line 1313  post_root(POST_ARGS)
Line 1312  post_root(POST_ARGS)
   
         if (NULL == mdoc->first->child)          if (NULL == mdoc->first->child)
                 return(verr(mdoc, ENODATA));                  return(verr(mdoc, ENODATA));
         if (SEC_PROLOGUE == mdoc->lastnamed)          if ( ! (MDOC_PBODY & mdoc->flags))
                 return(verr(mdoc, ENOPROLOGUE));                  return(verr(mdoc, ENOPROLOGUE));
   
         if (MDOC_BLOCK != mdoc->first->child->type)          if (MDOC_BLOCK != mdoc->first->child->type)
Line 1394  post_sh_head(POST_ARGS)
Line 1393  post_sh_head(POST_ARGS)
          * certain manual sections.           * certain manual sections.
          */           */
   
         assert(MDOC_Sh == mdoc->last->tok);  
   
         /* This is just concat() inlined, which is irritating. */  
   
         buf[0] = 0;          buf[0] = 0;
   
         for (n = mdoc->last->child; n; n = n->next) {          for (n = mdoc->last->child; n; n = n->next) {
                   /* XXX - copied from compact(). */
                 assert(MDOC_TEXT == n->type);                  assert(MDOC_TEXT == n->type);
   
                 if (strlcat(buf, n->string, 64) >= 64)                  if (strlcat(buf, n->string, 64) >= 64)
                         return(nerr(mdoc, n, ETOOLONG));                          return(nerr(mdoc, n, ETOOLONG));
                 if (NULL == n->next)                  if (NULL == n->next)
Line 1411  post_sh_head(POST_ARGS)
Line 1409  post_sh_head(POST_ARGS)
   
         sec = mdoc_atosec(buf);          sec = mdoc_atosec(buf);
   
         /* The NAME section should always be first. */          /*
            * Check: NAME should always be first, CUSTOM has no roles,
            * non-CUSTOM has a conventional order to be followed.
            */
   
         if (SEC_BODY == mdoc->lastnamed && SEC_NAME != sec)          if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)
                 return(vwarn(mdoc, WSECOOO));                  return(verr(mdoc, ESECNAME));
         if (SEC_CUSTOM == sec)          if (SEC_CUSTOM == sec)
                 return(1);                  return(1);
   
         /* Check for repeated or out-of-order sections. */  
   
         if (sec == mdoc->lastnamed)          if (sec == mdoc->lastnamed)
                 return(vwarn(mdoc, WSECREP));                  return(vwarn(mdoc, WSECREP));
         if (sec < mdoc->lastnamed)          if (sec < mdoc->lastnamed)
                 return(vwarn(mdoc, WSECOOO));                  return(vwarn(mdoc, WSECOOO));
   
         /* Check particular section/manual section conventions. */          /*
            * Check particular section/manual conventions.  LIBRARY can
            * only occur in msec 2, 3 (TODO: are there more of these?).
            */
   
         switch (sec) {          switch (sec) {
         case (SEC_LIBRARY):          case (SEC_LIBRARY):

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

CVSweb