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

Diff for /mandoc/Attic/validate.c between version 1.2 and 1.4

version 1.2, 2008/11/29 16:11:42 version 1.4, 2008/11/30 18:50:44
Line 52  static void   roffmsg(void *arg, enum roffmsg, 
Line 52  static void   roffmsg(void *arg, enum roffmsg, 
 static  int              roffhead(void *);  static  int              roffhead(void *);
 static  int              rofftail(void *);  static  int              rofftail(void *);
 static  int              roffin(void *, int, int *, char **);  static  int              roffin(void *, int, int *, char **);
 static  int              roffdata(void *, char *);  static  int              roffdata(void *, int, char *);
 static  int              roffout(void *, int);  static  int              roffout(void *, int);
 static  int              roffblkin(void *, int, int *, char **);  static  int              roffblkin(void *, int, int *, char **);
 static  int              roffblkout(void *, int);  static  int              roffblkout(void *, int);
Line 60  static int   roffspecial(void *, int);
Line 60  static int   roffspecial(void *, int);
   
 static  int              mbuf_newline(struct md_valid *);  static  int              mbuf_newline(struct md_valid *);
 static  int              mbuf_indent(struct md_valid *);  static  int              mbuf_indent(struct md_valid *);
 static  int              mbuf_data(struct md_valid *, char *);  static  int              mbuf_data(struct md_valid *, int, char *);
   
   
 static int  static int
Line 92  mbuf_newline(struct md_valid *p)
Line 92  mbuf_newline(struct md_valid *p)
   
   
 static int  static int
 mbuf_data(struct md_valid *p, char *buf)  mbuf_data(struct md_valid *p, int space, char *buf)
 {  {
         size_t           sz;          size_t           sz;
         char            *bufp;          char            *bufp;
Line 133  mbuf_data(struct md_valid *p, char *buf)
Line 133  mbuf_data(struct md_valid *p, char *buf)
                                 continue;                                  continue;
                         }                          }
   
                         if ( ! md_buf_putchar(p->mbuf, ' '))                          p->pos += sz;
                                 return(0);  
   
                         p->pos += sz + 1;  
                         continue;                          continue;
                 }                  }
   
Line 145  mbuf_data(struct md_valid *p, char *buf)
Line 142  mbuf_data(struct md_valid *p, char *buf)
                                 return(0);                                  return(0);
                         if ( ! mbuf_indent(p))                          if ( ! mbuf_indent(p))
                                 return(0);                                  return(0);
                 }                  } else if (space)
                           if ( ! md_buf_putchar(p->mbuf, ' '))
                                   return(0);
   
                 if ( ! md_buf_putstring(p->mbuf, bufp))                  if ( ! md_buf_putstring(p->mbuf, bufp))
                         return(0);                          return(0);
                 if ( ! md_buf_putchar(p->mbuf, ' '))  
                         return(0);  
   
                 p->pos += sz + 1;                  p->pos += sz + (space ? 1 : 0);
         }          }
   
         return(1);          return(1);
Line 227  roffhead(void *arg)
Line 224  roffhead(void *arg)
         assert(arg);          assert(arg);
         p = (struct md_valid *)arg;          p = (struct md_valid *)arg;
   
         if ( ! md_buf_putstring(p->mbuf, "BEGIN"))          if ( ! md_buf_putstring(p->mbuf, "<?xml version=\"1.0\" "
                                   "encoding=\"UTF-8\"?>\n"))
                 return(0);                  return(0);
         p->indent++;  
         if ( ! mbuf_newline(p))          if ( ! md_buf_putstring(p->mbuf, "<mdoc>"))
                 return(0);                  return(0);
           p->indent++;
   
         return(1);          return(mbuf_newline(p));
 }  }
   
   
Line 247  rofftail(void *arg)
Line 246  rofftail(void *arg)
   
         if (0 != p->pos && ! mbuf_newline(p))          if (0 != p->pos && ! mbuf_newline(p))
                 return(0);                  return(0);
           return(md_buf_putstring(p->mbuf, "</mdoc>\n"));
         if ( ! md_buf_putstring(p->mbuf, "END\n"))  
                 return(0);  
         return(1);  
 }  }
   
   
Line 334  roffin(void *arg, int tok, int *argcp, char **argvp)
Line 330  roffin(void *arg, int tok, int *argcp, char **argvp)
         if (0 == p->pos && ! mbuf_indent(p))          if (0 == p->pos && ! mbuf_indent(p))
                 return(0);                  return(0);
   
         if ( ! md_buf_putstring(p->mbuf, "<"))          /* FIXME: not always with a space... */
           if ( ! md_buf_putstring(p->mbuf, " <"))
                 return(0);                  return(0);
         if ( ! md_buf_putstring(p->mbuf, toknames[tok]))          if ( ! md_buf_putstring(p->mbuf, toknames[tok]))
                 return(0);                  return(0);
         if ( ! md_buf_putstring(p->mbuf, ">"))          if ( ! md_buf_putstring(p->mbuf, ">"))
                 return(0);                  return(0);
   
         p->pos += strlen(toknames[tok]) + 2;          p->pos += strlen(toknames[tok]) + 3;
   
         return(1);          return(1);
 }  }
Line 362  roffout(void *arg, int tok)
Line 359  roffout(void *arg, int tok)
                 return(0);                  return(0);
         if ( ! md_buf_putstring(p->mbuf, toknames[tok]))          if ( ! md_buf_putstring(p->mbuf, toknames[tok]))
                 return(0);                  return(0);
         if ( ! md_buf_putstring(p->mbuf, "> "))          if ( ! md_buf_putstring(p->mbuf, ">"))
                 return(0);                  return(0);
   
         p->pos += strlen(toknames[tok]) + 3;          p->pos += strlen(toknames[tok]) + 2;
   
         return(1);          return(1);
 }  }
Line 406  roffmsg(void *arg, enum roffmsg lvl, 
Line 403  roffmsg(void *arg, enum roffmsg lvl, 
   
   
 static int  static int
 roffdata(void *arg, char *buf)  roffdata(void *arg, int space, char *buf)
 {  {
         struct md_valid *p;          struct md_valid *p;
   
         assert(arg);          assert(arg);
         p = (struct md_valid *)arg;          p = (struct md_valid *)arg;
         return(mbuf_data(p, buf));          return(mbuf_data(p, space, buf));
 }  }

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

CVSweb