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

Diff for /mandoc/tbl_data.c between version 1.32 and 1.33

version 1.32, 2014/08/10 23:54:41 version 1.33, 2015/01/21 00:47:04
Line 30 
Line 30 
 #include "libmandoc.h"  #include "libmandoc.h"
 #include "libroff.h"  #include "libroff.h"
   
 static  int              getdata(struct tbl_node *, struct tbl_span *,  static  void             getdata(struct tbl_node *, struct tbl_span *,
                                 int, const char *, int *);                                  int, const char *, int *);
 static  struct tbl_span *newspan(struct tbl_node *, int,  static  struct tbl_span *newspan(struct tbl_node *, int,
                                 struct tbl_row *);                                  struct tbl_row *);
   
   
 static int  static void
 getdata(struct tbl_node *tbl, struct tbl_span *dp,  getdata(struct tbl_node *tbl, struct tbl_span *dp,
                 int ln, const char *p, int *pos)                  int ln, const char *p, int *pos)
 {  {
Line 69  getdata(struct tbl_node *tbl, struct tbl_span *dp,
Line 69  getdata(struct tbl_node *tbl, struct tbl_span *dp,
                 /* Skip to the end... */                  /* Skip to the end... */
                 while (p[*pos])                  while (p[*pos])
                         (*pos)++;                          (*pos)++;
                 return(1);                  return;
         }          }
   
         dat = mandoc_calloc(1, sizeof(struct tbl_dat));          dat = mandoc_calloc(1, sizeof(struct tbl_dat));
Line 104  getdata(struct tbl_node *tbl, struct tbl_span *dp,
Line 104  getdata(struct tbl_node *tbl, struct tbl_span *dp,
   
         if (*pos - sv == 2 && 'T' == p[sv] && '{' == p[sv + 1]) {          if (*pos - sv == 2 && 'T' == p[sv] && '{' == p[sv + 1]) {
                 tbl->part = TBL_PART_CDATA;                  tbl->part = TBL_PART_CDATA;
                 return(1);                  return;
         }          }
   
         assert(*pos - sv >= 0);          assert(*pos - sv >= 0);
Line 134  getdata(struct tbl_node *tbl, struct tbl_span *dp,
Line 134  getdata(struct tbl_node *tbl, struct tbl_span *dp,
                         mandoc_msg(MANDOCERR_TBLIGNDATA,                          mandoc_msg(MANDOCERR_TBLIGNDATA,
                             tbl->parse, ln, sv, NULL);                              tbl->parse, ln, sv, NULL);
   
         return(1);          return;
 }  }
   
 int  int
Line 153  tbl_cdata(struct tbl_node *tbl, int ln, const char *p)
Line 153  tbl_cdata(struct tbl_node *tbl, int ln, const char *p)
                 if (p[pos] == tbl->opts.tab) {                  if (p[pos] == tbl->opts.tab) {
                         tbl->part = TBL_PART_DATA;                          tbl->part = TBL_PART_DATA;
                         pos++;                          pos++;
                         return(getdata(tbl, tbl->last_span, ln, p, &pos));                          getdata(tbl, tbl->last_span, ln, p, &pos);
                           return(1);
                 } else if ('\0' == p[pos]) {                  } else if ('\0' == p[pos]) {
                         tbl->part = TBL_PART_DATA;                          tbl->part = TBL_PART_DATA;
                         return(1);                          return(1);
Line 202  newspan(struct tbl_node *tbl, int line, struct tbl_row
Line 203  newspan(struct tbl_node *tbl, int line, struct tbl_row
         return(dp);          return(dp);
 }  }
   
 int  void
 tbl_data(struct tbl_node *tbl, int ln, const char *p)  tbl_data(struct tbl_node *tbl, int ln, const char *p)
 {  {
         struct tbl_span *dp;          struct tbl_span *dp;
         struct tbl_row  *rp;          struct tbl_row  *rp;
         int              pos;          int              pos;
   
         pos = 0;  
   
         if ('\0' == p[pos]) {  
                 mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, pos, NULL);  
                 return(0);  
         }  
   
         /*          /*
          * Choose a layout row: take the one following the last parsed           * Choose a layout row: take the one following the last parsed
          * span's.  If that doesn't exist, use the last parsed span's.           * span's.  If that doesn't exist, use the last parsed span's.
Line 257  tbl_data(struct tbl_node *tbl, int ln, const char *p)
Line 251  tbl_data(struct tbl_node *tbl, int ln, const char *p)
   
         if ( ! strcmp(p, "_")) {          if ( ! strcmp(p, "_")) {
                 dp->pos = TBL_SPAN_HORIZ;                  dp->pos = TBL_SPAN_HORIZ;
                 return(1);                  return;
         } else if ( ! strcmp(p, "=")) {          } else if ( ! strcmp(p, "=")) {
                 dp->pos = TBL_SPAN_DHORIZ;                  dp->pos = TBL_SPAN_DHORIZ;
                 return(1);                  return;
         }          }
   
         dp->pos = TBL_SPAN_DATA;          dp->pos = TBL_SPAN_DATA;
   
         /* This returns 0 when TBL_PART_CDATA is entered. */          pos = 0;
   
         while ('\0' != p[pos])          while ('\0' != p[pos])
                 if ( ! getdata(tbl, dp, ln, p, &pos))                  getdata(tbl, dp, ln, p, &pos);
                         return(0);  
   
         return(1);  
 }  }

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

CVSweb