[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.29 and 1.30

version 1.29, 2014/03/23 11:25:26 version 1.30, 2014/04/20 16:46:05
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  int              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 int
 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)
 {  {
         struct tbl_dat  *dat;          struct tbl_dat  *dat;
Line 49  getdata(struct tbl_node *tbl, struct tbl_span *dp, 
Line 50  getdata(struct tbl_node *tbl, struct tbl_span *dp, 
         else if (NULL == dp->last)          else if (NULL == dp->last)
                 cp = dp->layout->first;                  cp = dp->layout->first;
   
         /*          /*
          * Skip over spanners, since           * Skip over spanners, since
          * we want to match data with data layout cells in the header.           * we want to match data with data layout cells in the header.
          */           */
Line 63  getdata(struct tbl_node *tbl, struct tbl_span *dp, 
Line 64  getdata(struct tbl_node *tbl, struct tbl_span *dp, 
          */           */
   
         if (NULL == cp) {          if (NULL == cp) {
                 mandoc_msg(MANDOCERR_TBLEXTRADAT,                  mandoc_msg(MANDOCERR_TBLEXTRADAT, tbl->parse,
                                 tbl->parse, ln, *pos, NULL);                      ln, *pos, NULL);
                 /* Skip to the end... */                  /* Skip to the end... */
                 while (p[*pos])                  while (p[*pos])
                         (*pos)++;                          (*pos)++;
Line 82  getdata(struct tbl_node *tbl, struct tbl_span *dp, 
Line 83  getdata(struct tbl_node *tbl, struct tbl_span *dp, 
                         spans++;                          spans++;
                 else                  else
                         break;                          break;
   
         dat->spans = spans;          dat->spans = spans;
   
         if (dp->last) {          if (dp->last) {
Line 127  getdata(struct tbl_node *tbl, struct tbl_span *dp, 
Line 128  getdata(struct tbl_node *tbl, struct tbl_span *dp, 
                 dat->pos = TBL_DATA_DATA;                  dat->pos = TBL_DATA_DATA;
   
         if (TBL_CELL_HORIZ == dat->layout->pos ||          if (TBL_CELL_HORIZ == dat->layout->pos ||
                         TBL_CELL_DHORIZ == dat->layout->pos ||              TBL_CELL_DHORIZ == dat->layout->pos ||
                         TBL_CELL_DOWN == dat->layout->pos)              TBL_CELL_DOWN == dat->layout->pos)
                 if (TBL_DATA_DATA == dat->pos && '\0' != *dat->string)                  if (TBL_DATA_DATA == dat->pos && '\0' != *dat->string)
                         mandoc_msg(MANDOCERR_TBLIGNDATA,                          mandoc_msg(MANDOCERR_TBLIGNDATA,
                                         tbl->parse, ln, sv, NULL);                              tbl->parse, ln, sv, NULL);
   
         return(1);          return(1);
 }  }
   
 /* ARGSUSED */  
 int  int
 tbl_cdata(struct tbl_node *tbl, int ln, const char *p)  tbl_cdata(struct tbl_node *tbl, int ln, const char *p)
 {  {
         struct tbl_dat  *dat;          struct tbl_dat  *dat;
         size_t           sz;          size_t           sz;
         int              pos;          int              pos;
   
         pos = 0;          pos = 0;
Line 172  tbl_cdata(struct tbl_node *tbl, int ln, const char *p)
Line 172  tbl_cdata(struct tbl_node *tbl, int ln, const char *p)
         } else          } else
                 dat->string = mandoc_strdup(p);                  dat->string = mandoc_strdup(p);
   
         if (TBL_CELL_DOWN == dat->layout->pos)          if (TBL_CELL_DOWN == dat->layout->pos)
                 mandoc_msg(MANDOCERR_TBLIGNDATA,                  mandoc_msg(MANDOCERR_TBLIGNDATA, tbl->parse,
                                 tbl->parse, ln, pos, NULL);                      ln, pos, NULL);
   
         return(0);          return(0);
 }  }
Line 216  tbl_data(struct tbl_node *tbl, int ln, const char *p)
Line 216  tbl_data(struct tbl_node *tbl, int ln, const char *p)
                 return(0);                  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.
          * If there's no last parsed span, use the first row.  Lastly,           * If there's no last parsed span, use the first row.  Lastly,
Line 230  tbl_data(struct tbl_node *tbl, int ln, const char *p)
Line 230  tbl_data(struct tbl_node *tbl, int ln, const char *p)
                         for (rp = tbl->last_span->layout->next;                          for (rp = tbl->last_span->layout->next;
                                         rp && rp->first; rp = rp->next) {                                          rp && rp->first; rp = rp->next) {
                                 switch (rp->first->pos) {                                  switch (rp->first->pos) {
                                 case (TBL_CELL_HORIZ):                                  case TBL_CELL_HORIZ:
                                         dp = newspan(tbl, ln, rp);                                          dp = newspan(tbl, ln, rp);
                                         dp->pos = TBL_SPAN_HORIZ;                                          dp->pos = TBL_SPAN_HORIZ;
                                         continue;                                          continue;
                                 case (TBL_CELL_DHORIZ):                                  case TBL_CELL_DHORIZ:
                                         dp = newspan(tbl, ln, rp);                                          dp = newspan(tbl, ln, rp);
                                         dp->pos = TBL_SPAN_DHORIZ;                                          dp->pos = TBL_SPAN_DHORIZ;
                                         continue;                                          continue;

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

CVSweb