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

Diff for /mandoc/Attic/mdocterm.c between version 1.28 and 1.33

version 1.28, 2009/03/03 22:17:19 version 1.33, 2009/03/05 13:12:12
Line 78  static struct termenc   termenc1[] = {
Line 78  static struct termenc   termenc1[] = {
 static  struct termenc    termenc2[] = {  static  struct termenc    termenc2[] = {
         { "rB",           TERMSYM_RBRACK },          { "rB",           TERMSYM_RBRACK },
         { "lB",           TERMSYM_LBRACK },          { "lB",           TERMSYM_LBRACK },
           { "ra",           TERMSYM_RANGLE },
           { "la",           TERMSYM_LANGLE },
         { "Lq",           TERMSYM_LDQUOTE },          { "Lq",           TERMSYM_LDQUOTE },
         { "lq",           TERMSYM_LDQUOTE },          { "lq",           TERMSYM_LDQUOTE },
         { "Rq",           TERMSYM_RDQUOTE },          { "Rq",           TERMSYM_RDQUOTE },
Line 99  static struct termenc   termenc2[] = {
Line 101  static struct termenc   termenc2[] = {
         { "Le",           TERMSYM_LE },          { "Le",           TERMSYM_LE },
         { "<=",           TERMSYM_LE },          { "<=",           TERMSYM_LE },
         { "Ge",           TERMSYM_GE },          { "Ge",           TERMSYM_GE },
         { "=>",           TERMSYM_GE },          { ">=",           TERMSYM_GE },
         { "==",           TERMSYM_EQ },          { "==",           TERMSYM_EQ },
         { "Ne",           TERMSYM_NEQ },          { "Ne",           TERMSYM_NEQ },
         { "!=",           TERMSYM_NEQ },          { "!=",           TERMSYM_NEQ },
Line 161  static struct termsym   termsym_ansi[] = {
Line 163  static struct termsym   termsym_ansi[] = {
         { " ", 1 },             /* TERMSYM_SPACE */          { " ", 1 },             /* TERMSYM_SPACE */
         { ".", 1 },             /* TERMSYM_PERIOD */          { ".", 1 },             /* TERMSYM_PERIOD */
         { "", 0 },              /* TERMSYM_BREAK */          { "", 0 },              /* TERMSYM_BREAK */
           { "<", 1 },             /* TERMSYM_LANGLE */
           { ">", 1 },             /* TERMSYM_RANGLE */
 };  };
   
 static  const char        ansi_clear[]  = { 27, '[', '0', 'm' };  static  const char        ansi_clear[]  = { 27, '[', '0', 'm' };
Line 189  main(int argc, char *argv[])
Line 193  main(int argc, char *argv[])
         if (NULL == (mdoc = mmain_mdoc(p)))          if (NULL == (mdoc = mmain_mdoc(p)))
                 mmain_exit(p, 1);                  mmain_exit(p, 1);
   
         termp.maxrmargin = 78; /* XXX */          termp.maxrmargin = termp.rmargin = 78; /* XXX */
         termp.rmargin = termp.maxrmargin;  
         termp.maxcols = 1024;          termp.maxcols = 1024;
         termp.offset = termp.col = 0;          termp.offset = termp.col = 0;
         termp.flags = TERMP_NOSPACE;          termp.flags = TERMP_NOSPACE;
Line 284  flushln(struct termp *p)
Line 287  flushln(struct termp *p)
   
                 /* LINTED */                  /* LINTED */
                 for (j = i, vsz = 0; j < p->col; j++) {                  for (j = i, vsz = 0; j < p->col; j++) {
                         if (isspace((int)p->buf[j]))                          if (isspace((u_char)p->buf[j]))
                                 break;                                  break;
                         else if (27 == p->buf[j]) {                          else if (27 == p->buf[j]) {
                                 assert(j + 4 <= p->col);                                  assert(j + 4 <= p->col);
Line 317  flushln(struct termp *p)
Line 320  flushln(struct termp *p)
                                 putchar('\n');                                  putchar('\n');
                                 for (j = 0; j < p->rmargin; j++)                                  for (j = 0; j < p->rmargin; j++)
                                         putchar(' ');                                          putchar(' ');
                                 vis = p->rmargin;                                  vis = p->rmargin - p->offset;
                         } else if (vis + vsz > bp)                          } else if (vis + vsz > bp)
                                 warnx("word breaks right margin");                                  warnx("word breaks right margin");
   
Line 331  flushln(struct termp *p)
Line 334  flushln(struct termp *p)
                  */                   */
   
                 for ( ; i < p->col; i++) {                  for ( ; i < p->col; i++) {
                         if (isspace((int)p->buf[i]))                          if (isspace((u_char)p->buf[i]))
                                 break;                                  break;
                         putchar(p->buf[i]);                          putchar(p->buf[i]);
                 }                  }
Line 348  flushln(struct termp *p)
Line 351  flushln(struct termp *p)
          */           */
   
         if ((TERMP_NOBREAK & p->flags) && vis >= maxvis) {          if ((TERMP_NOBREAK & p->flags) && vis >= maxvis) {
                 putchar('\n');                  if ( ! (TERMP_NONOBREAK & p->flags)) {
                 for (i = 0; i < p->rmargin; i++)                          putchar('\n');
                         putchar(' ');                          for (i = 0; i < p->rmargin; i++)
                                   putchar(' ');
                   }
                 p->col = 0;                  p->col = 0;
                 return;                  return;
         }          }
Line 360  flushln(struct termp *p)
Line 365  flushln(struct termp *p)
          * pad to the right margin and stay off.           * pad to the right margin and stay off.
          */           */
   
         if (p->flags & TERMP_NOBREAK)          if (p->flags & TERMP_NOBREAK) {
                 for ( ; vis < maxvis; vis++)                  if ( ! (TERMP_NONOBREAK & p->flags))
                         putchar(' ');                          for ( ; vis < maxvis; vis++)
         else                                  putchar(' ');
           } else
                 putchar('\n');                  putchar('\n');
   
         p->col = 0;          p->col = 0;
Line 431  word(struct termp *p, const char *word)
Line 437  word(struct termp *p, const char *word)
   
         /* LINTED */          /* LINTED */
         for (j = i = 0; i < len; i++) {          for (j = i = 0; i < len; i++) {
                 if ( ! isspace((int)word[i])) {                  if ( ! isspace((u_char)word[i])) {
                         j++;                          j++;
                         continue;                          continue;
                 }                  }
   
                 /* Escaped spaces don't delimit... */                  /* Escaped spaces don't delimit... */
                 if (i > 0 && isspace((int)word[i]) &&                  if (i > 0 && isspace((u_char)word[i]) &&
                                 '\\' == word[i - 1]) {                                  '\\' == word[i - 1]) {
                         j++;                          j++;
                         continue;                          continue;
Line 643  header(struct termp *p, const struct mdoc_meta *meta)
Line 649  header(struct termp *p, const struct mdoc_meta *meta)
                         meta->title, pp ? pp : "");                          meta->title, pp ? pp : "");
   
         for (bufp = title; *bufp; bufp++)          for (bufp = title; *bufp; bufp++)
                 *bufp = toupper(*bufp);                  *bufp = toupper((u_char)*bufp);
   
         p->offset = 0;          p->offset = 0;
         p->rmargin = (p->maxrmargin - strlen(buf)) / 2;          p->rmargin = (p->maxrmargin - strlen(buf)) / 2;

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

CVSweb