Print this page
5051 import mdocml-1.12.3
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: TBD

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mandoc/tbl_data.c
          +++ new/usr/src/cmd/mandoc/tbl_data.c
   1      -/*      $Id: tbl_data.c,v 1.24 2011/03/20 16:02:05 kristaps Exp $ */
        1 +/*      $Id: tbl_data.c,v 1.27 2013/06/01 04:56:50 schwarze Exp $ */
   2    2  /*
   3    3   * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
   4    4   * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
   5    5   *
   6    6   * Permission to use, copy, modify, and distribute this software for any
   7    7   * purpose with or without fee is hereby granted, provided that the above
   8    8   * copyright notice and this permission notice appear in all copies.
   9    9   *
  10   10   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11   11   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
↓ open down ↓ 30 lines elided ↑ open up ↑
  42   42          struct tbl_cell *cp;
  43   43          int              sv, spans;
  44   44  
  45   45          cp = NULL;
  46   46          if (dp->last && dp->last->layout)
  47   47                  cp = dp->last->layout->next;
  48   48          else if (NULL == dp->last)
  49   49                  cp = dp->layout->first;
  50   50  
  51   51          /* 
  52      -         * Skip over spanners and vertical lines to data formats, since
       52 +         * Skip over spanners, since
  53   53           * we want to match data with data layout cells in the header.
  54   54           */
  55   55  
  56      -        while (cp && (TBL_CELL_VERT == cp->pos || 
  57      -                                TBL_CELL_DVERT == cp->pos ||
  58      -                                TBL_CELL_SPAN == cp->pos))
       56 +        while (cp && TBL_CELL_SPAN == cp->pos)
  59   57                  cp = cp->next;
  60   58  
  61   59          /*
  62   60           * Stop processing when we reach the end of the available layout
  63   61           * cells.  This means that we have extra input.
  64   62           */
  65   63  
  66   64          if (NULL == cp) {
  67   65                  mandoc_msg(MANDOCERR_TBLEXTRADAT, 
  68   66                                  tbl->parse, ln, *pos, NULL);
↓ open down ↓ 28 lines elided ↑ open up ↑
  97   95                  (*pos)++;
  98   96  
  99   97          /*
 100   98           * Check for a continued-data scope opening.  This consists of a
 101   99           * trailing `T{' at the end of the line.  Subsequent lines,
 102  100           * until a standalone `T}', are included in our cell.
 103  101           */
 104  102  
 105  103          if (*pos - sv == 2 && 'T' == p[sv] && '{' == p[sv + 1]) {
 106  104                  tbl->part = TBL_PART_CDATA;
 107      -                return(0);
      105 +                return(1);
 108  106          }
 109  107  
 110  108          assert(*pos - sv >= 0);
 111  109  
 112  110          dat->string = mandoc_malloc((size_t)(*pos - sv + 1));
 113  111          memcpy(dat->string, &p[sv], (size_t)(*pos - sv));
 114  112          dat->string[*pos - sv] = '\0';
 115  113  
 116  114          if (p[*pos])
 117  115                  (*pos)++;
↓ open down ↓ 62 lines elided ↑ open up ↑
 180  178          return(0);
 181  179  }
 182  180  
 183  181  static struct tbl_span *
 184  182  newspan(struct tbl_node *tbl, int line, struct tbl_row *rp)
 185  183  {
 186  184          struct tbl_span *dp;
 187  185  
 188  186          dp = mandoc_calloc(1, sizeof(struct tbl_span));
 189  187          dp->line = line;
 190      -        dp->tbl = &tbl->opts;
      188 +        dp->opts = &tbl->opts;
 191  189          dp->layout = rp;
 192  190          dp->head = tbl->first_head;
 193  191  
 194  192          if (tbl->last_span) {
 195  193                  tbl->last_span->next = dp;
 196  194                  tbl->last_span = dp;
 197  195          } else {
 198  196                  tbl->last_span = tbl->first_span = dp;
 199  197                  tbl->current_span = NULL;
 200  198                  dp->flags |= TBL_SPAN_FIRST;
↓ open down ↓ 76 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX