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

Diff for /mandoc/term.c between version 1.132 and 1.135

version 1.132, 2010/05/07 04:50:44 version 1.135, 2010/05/16 01:35:37
Line 34 
Line 34 
 #include "mdoc.h"  #include "mdoc.h"
 #include "main.h"  #include "main.h"
   
 static  struct termp     *term_alloc(enum termenc);  static  struct termp     *term_alloc(enum termenc, size_t);
 static  void              term_free(struct termp *);  static  void              term_free(struct termp *);
 static  void              spec(struct termp *, const char *, size_t);  static  void              spec(struct termp *, const char *, size_t);
 static  void              res(struct termp *, const char *, size_t);  static  void              res(struct termp *, const char *, size_t);
Line 45  static void    encode(struct termp *, const char *, si
Line 45  static void    encode(struct termp *, const char *, si
   
   
 void *  void *
 ascii_alloc(void)  ascii_alloc(size_t width)
 {  {
   
         return(term_alloc(TERMENC_ASCII));          return(term_alloc(TERMENC_ASCII, width));
 }  }
   
   
Line 74  term_free(struct termp *p)
Line 74  term_free(struct termp *p)
   
   
 static struct termp *  static struct termp *
 term_alloc(enum termenc enc)  term_alloc(enum termenc enc, size_t width)
 {  {
         struct termp *p;          struct termp *p;
   
Line 84  term_alloc(enum termenc enc)
Line 84  term_alloc(enum termenc enc)
                 exit(EXIT_FAILURE);                  exit(EXIT_FAILURE);
         }          }
         p->enc = enc;          p->enc = enc;
           /* Enforce some lower boundary. */
           if (width < 60)
                   width = 60;
           p->defrmargin = width - 2;
         return(p);          return(p);
 }  }
   
Line 229  term_flushln(struct termp *p)
Line 233  term_flushln(struct termp *p)
                 for ( ; i < (int)p->col; i++)                  for ( ; i < (int)p->col; i++)
                         if (' ' == p->buf[i])                          if (' ' == p->buf[i])
                                 break;                                  break;
                         else if (31 == p->buf[i])                          else if (ASCII_NBRSP == p->buf[i])
                                 putchar(' ');                                  putchar(' ');
                         else                          else
                                 putchar(p->buf[i]);                                  putchar(p->buf[i]);
Line 445  term_word(struct termp *p, const char *word)
Line 449  term_word(struct termp *p, const char *word)
                         break;                          break;
                 }                  }
   
         if ( ! (TERMP_NOSPACE & p->flags))          if ( ! (TERMP_NOSPACE & p->flags)) {
                 bufferc(p, ' ');                  bufferc(p, ' ');
                   if (TERMP_SENTENCE & p->flags)
                           bufferc(p, ' ');
           }
   
         if ( ! (p->flags & TERMP_NONOSPACE))          if ( ! (p->flags & TERMP_NONOSPACE))
                 p->flags &= ~TERMP_NOSPACE;                  p->flags &= ~TERMP_NOSPACE;
   
           p->flags &= ~TERMP_SENTENCE;
   
         /* FIXME: use strcspn. */          /* FIXME: use strcspn. */
   

Legend:
Removed from v.1.132  
changed lines
  Added in v.1.135

CVSweb