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

Diff for /mandoc/tbl_term.c between version 1.16 and 1.17

version 1.16, 2011/01/10 14:40:30 version 1.17, 2011/01/10 14:56:06
Line 355  tbl_literal(struct termp *tp, const struct tbl_dat *dp
Line 355  tbl_literal(struct termp *tp, const struct tbl_dat *dp
                 const struct roffcol *col)                  const struct roffcol *col)
 {  {
         size_t           padl, padr, ssz;          size_t           padl, padr, ssz;
         const char      *str;  
   
         padl = padr = 0;          padl = padr = 0;
   
         str = dp->string ? dp->string : "";          assert(dp->string);
   
         ssz = term_len(tp, 1);          ssz = term_len(tp, 1);
   
         switch (dp->layout->pos) {          switch (dp->layout->pos) {
         case (TBL_CELL_LONG):          case (TBL_CELL_LONG):
                 padl = ssz;                  padl = ssz;
                 padr = col->width - term_strlen(tp, str) - ssz;                  padr = col->width - term_strlen(tp, dp->string) - ssz;
                 break;                  break;
         case (TBL_CELL_CENTRE):          case (TBL_CELL_CENTRE):
                 padl = col->width - term_strlen(tp, str);                  padl = col->width - term_strlen(tp, dp->string);
                 if (padl % 2)                  if (padl % 2)
                         padr++;                          padr++;
                 padl /= 2;                  padl /= 2;
                 padr += padl;                  padr += padl;
                 break;                  break;
         case (TBL_CELL_RIGHT):          case (TBL_CELL_RIGHT):
                 padl = col->width - term_strlen(tp, str);                  padl = col->width - term_strlen(tp, dp->string);
                 break;                  break;
         default:          default:
                 padr = col->width - term_strlen(tp, str);                  padr = col->width - term_strlen(tp, dp->string);
                 break;                  break;
         }          }
   
         tbl_char(tp, ASCII_NBRSP, padl);          tbl_char(tp, ASCII_NBRSP, padl);
         term_word(tp, str);          term_word(tp, dp->string);
         tbl_char(tp, ASCII_NBRSP, padr);          tbl_char(tp, ASCII_NBRSP, padr);
 }  }
   
Line 395  tbl_number(struct termp *tp, const struct tbl *tbl,
Line 394  tbl_number(struct termp *tp, const struct tbl *tbl,
 {  {
         char            *cp;          char            *cp;
         char             buf[2];          char             buf[2];
         const char      *str;  
         size_t           sz, psz, ssz, d, padl;          size_t           sz, psz, ssz, d, padl;
         int              i;          int              i;
   
Line 404  tbl_number(struct termp *tp, const struct tbl *tbl,
Line 402  tbl_number(struct termp *tp, const struct tbl *tbl,
          * and the maximum decimal; right-pad by the remaining amount.           * and the maximum decimal; right-pad by the remaining amount.
          */           */
   
         str = dp->string ? dp->string : "";          assert(dp->string);
   
         sz = term_strlen(tp, str);          sz = term_strlen(tp, dp->string);
   
         buf[0] = tbl->decimal;          buf[0] = tbl->decimal;
         buf[1] = '\0';          buf[1] = '\0';
   
         psz = term_strlen(tp, buf);          psz = term_strlen(tp, buf);
   
         if (NULL != (cp = strrchr(str, tbl->decimal))) {          if (NULL != (cp = strrchr(dp->string, tbl->decimal))) {
                 buf[1] = '\0';                  buf[1] = '\0';
                 for (ssz = 0, i = 0; cp != &str[i]; i++) {                  for (ssz = 0, i = 0; cp != &dp->string[i]; i++) {
                         buf[0] = str[i];                          buf[0] = dp->string[i];
                         ssz += term_strlen(tp, buf);                          ssz += term_strlen(tp, buf);
                 }                  }
                 d = ssz + psz;                  d = ssz + psz;
Line 429  tbl_number(struct termp *tp, const struct tbl *tbl,
Line 427  tbl_number(struct termp *tp, const struct tbl *tbl,
         padl = col->decimal - d;          padl = col->decimal - d;
   
         tbl_char(tp, ASCII_NBRSP, padl);          tbl_char(tp, ASCII_NBRSP, padl);
         term_word(tp, str);          term_word(tp, dp->string);
         tbl_char(tp, ASCII_NBRSP, col->width - sz - padl);          tbl_char(tp, ASCII_NBRSP, col->width - sz - padl);
 }  }
   

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

CVSweb