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

Diff for /mandoc/tbl_layout.c between version 1.49 and 1.50

version 1.49, 2020/09/01 18:25:28 version 1.50, 2021/08/10 12:55:04
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2012, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2012, 2014, 2015, 2017, 2020, 2021
    *               Ingo Schwarze <schwarze@openbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 67  mods(struct tbl_node *tbl, struct tbl_cell *cp,
Line 68  mods(struct tbl_node *tbl, struct tbl_cell *cp,
         char            *endptr;          char            *endptr;
         unsigned long    spacing;          unsigned long    spacing;
         size_t           sz;          size_t           sz;
           int              isz;
           enum mandoc_esc  fontesc;
   
 mod:  mod:
         while (p[*pos] == ' ' || p[*pos] == '\t')          while (p[*pos] == ' ' || p[*pos] == '\t')
Line 105  mod:
Line 108  mod:
   
         switch (tolower((unsigned char)p[(*pos)++])) {          switch (tolower((unsigned char)p[(*pos)++])) {
         case 'b':          case 'b':
                 cp->flags |= TBL_CELL_BOLD;                  cp->font = ESCAPE_FONTBOLD;
                 goto mod;                  goto mod;
         case 'd':          case 'd':
                 cp->flags |= TBL_CELL_BALIGN;                  cp->flags |= TBL_CELL_BALIGN;
Line 116  mod:
Line 119  mod:
         case 'f':          case 'f':
                 break;                  break;
         case 'i':          case 'i':
                 cp->flags |= TBL_CELL_ITALIC;                  cp->font = ESCAPE_FONTITALIC;
                 goto mod;                  goto mod;
         case 'm':          case 'm':
                 mandoc_msg(MANDOCERR_TBLLAYOUT_MOD, ln, *pos, "m");                  mandoc_msg(MANDOCERR_TBLLAYOUT_MOD, ln, *pos, "m");
Line 170  mod:
Line 173  mod:
                 goto mod;                  goto mod;
         }          }
   
           while (p[*pos] == ' ' || p[*pos] == '\t')
                   (*pos)++;
   
         /* Ignore parenthised font names for now. */          /* Ignore parenthised font names for now. */
   
         if (p[*pos] == '(')          if (p[*pos] == '(')
                 goto mod;                  goto mod;
   
         /* Support only one-character font-names for now. */          isz = 0;
           if (p[*pos] != '\0')
                   isz++;
           if (strchr(" \t.", p[*pos + isz]) == NULL)
                   isz++;
   
           fontesc = mandoc_font(p + *pos, isz);
   
         if (p[*pos] == '\0' || (p[*pos + 1] != ' ' && p[*pos + 1] != '.')) {          switch (fontesc) {
           case ESCAPE_FONTPREV:
           case ESCAPE_ERROR:
                 mandoc_msg(MANDOCERR_FT_BAD,                  mandoc_msg(MANDOCERR_FT_BAD,
                     ln, *pos, "TS %s", p + *pos - 1);                      ln, *pos, "TS %s", p + *pos - 1);
                 if (p[*pos] != '\0')                  break;
                         (*pos)++;  
                 if (p[*pos] != '\0')  
                         (*pos)++;  
                 goto mod;  
         }  
   
         switch (p[(*pos)++]) {  
         case '3':  
         case 'B':  
                 cp->flags |= TBL_CELL_BOLD;  
                 goto mod;  
         case '2':  
         case 'I':  
                 cp->flags |= TBL_CELL_ITALIC;  
                 goto mod;  
         case '1':  
         case 'R':  
                 goto mod;  
         default:          default:
                 mandoc_msg(MANDOCERR_FT_BAD,                  cp->font = fontesc;
                     ln, *pos - 1, "TS f%c", p[*pos - 1]);                  break;
                 goto mod;  
         }          }
           *pos += isz;
           goto mod;
 }  }
   
 static void  static void
Line 362  cell_alloc(struct tbl_node *tbl, struct tbl_row *rp, e
Line 359  cell_alloc(struct tbl_node *tbl, struct tbl_row *rp, e
   
         p = mandoc_calloc(1, sizeof(*p));          p = mandoc_calloc(1, sizeof(*p));
         p->spacing = SIZE_MAX;          p->spacing = SIZE_MAX;
           p->font = ESCAPE_FONTROMAN;
         p->pos = pos;          p->pos = pos;
   
         if ((pp = rp->last) != NULL) {          if ((pp = rp->last) != NULL) {

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

CVSweb