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

Diff for /mandoc/mdoc_macro.c between version 1.49 and 1.52

version 1.49, 2010/03/31 08:04:57 version 1.52, 2010/04/06 07:17:51
Line 27 
Line 27 
   
 #include "libmdoc.h"  #include "libmdoc.h"
   
 #define REWIND_REWIND   (1 << 0)  enum    rew {
 #define REWIND_NOHALT   (1 << 1)          REWIND_REWIND,
 #define REWIND_HALT     (1 << 2)          REWIND_NOHALT,
           REWIND_HALT
   };
   
 static  int       ctx_synopsis(MACRO_PROT_ARGS);  static  int       ctx_synopsis(MACRO_PROT_ARGS);
 static  int       obsolete(MACRO_PROT_ARGS);  static  int       obsolete(MACRO_PROT_ARGS);
Line 42  static int   blk_exp_close(MACRO_PROT_ARGS);
Line 44  static int   blk_exp_close(MACRO_PROT_ARGS);
 static  int       blk_part_imp(MACRO_PROT_ARGS);  static  int       blk_part_imp(MACRO_PROT_ARGS);
   
 static  int       phrase(struct mdoc *, int, int, char *);  static  int       phrase(struct mdoc *, int, int, char *);
 static  int       rew_dohalt(enum mdoct, enum mdoc_type,  static  enum rew  rew_dohalt(enum mdoct, enum mdoc_type,
                         const struct mdoc_node *);                          const struct mdoc_node *);
 static  enum mdoct rew_alt(enum mdoct);  static  enum mdoct rew_alt(enum mdoct);
 static  int       rew_dobreak(enum mdoct, const struct mdoc_node *);  static  int       rew_dobreak(enum mdoct, const struct mdoc_node *);
Line 137  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
Line 139  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Nx */          { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Nx */
         { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ox */          { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ox */
         { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Pc */          { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Pc */
         { in_line_argn, MDOC_PARSED | MDOC_IGNDELIM }, /* Pf */          { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* Pf */
         { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Po */          { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Po */
         { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Pq */          { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Pq */
         { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Qc */          { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Qc */
Line 368  rew_alt(enum mdoct tok)
Line 370  rew_alt(enum mdoct tok)
  * close our current scope (REWIND_REWIND), or continue (REWIND_NOHALT).   * close our current scope (REWIND_REWIND), or continue (REWIND_NOHALT).
  * The scope-closing and so on occurs in the various rew_* routines.   * The scope-closing and so on occurs in the various rew_* routines.
  */   */
 static int  static enum rew
 rew_dohalt(enum mdoct tok, enum mdoc_type type,  rew_dohalt(enum mdoct tok, enum mdoc_type type,
                 const struct mdoc_node *p)                  const struct mdoc_node *p)
 {  {
Line 574  rew_sub(enum mdoc_type t, struct mdoc *m, 
Line 576  rew_sub(enum mdoc_type t, struct mdoc *m, 
                 enum mdoct tok, int line, int ppos)                  enum mdoct tok, int line, int ppos)
 {  {
         struct mdoc_node *n;          struct mdoc_node *n;
         int               c;          enum rew          c;
   
         /* LINTED */          /* LINTED */
         for (n = m->last; n; n = n->parent) {          for (n = m->last; n; n = n->parent) {
Line 818  in_line(MACRO_PROT_ARGS)
Line 820  in_line(MACRO_PROT_ARGS)
                  * the word.                   * the word.
                  */                   */
   
                 d = mdoc_isdelim(p);                  d = ARGS_QWORD == w ? 0 : mdoc_isdelim(p);
   
                 if (ARGS_QWORD != w && d) {                  if (ARGS_QWORD != w && d) {
                         if (0 == lastpunct && ! rew_elem(m, tok))                          if (0 == lastpunct && ! rew_elem(m, tok))
Line 954  blk_full(MACRO_PROT_ARGS)
Line 956  blk_full(MACRO_PROT_ARGS)
                 /* Don't emit leading punct. for phrases. */                  /* Don't emit leading punct. for phrases. */
   
                 if (NULL == head && ARGS_PHRASE != c &&                  if (NULL == head && ARGS_PHRASE != c &&
                                   ARGS_QWORD != c &&
                                 1 == mdoc_isdelim(p)) {                                  1 == mdoc_isdelim(p)) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! mdoc_word_alloc(m, line, la, p))
                                 return(0);                                  return(0);
Line 1077  blk_part_imp(MACRO_PROT_ARGS)
Line 1080  blk_part_imp(MACRO_PROT_ARGS)
                 if (ARGS_PUNCT == c)                  if (ARGS_PUNCT == c)
                         break;                          break;
   
                 if (NULL == body && 1 == mdoc_isdelim(p)) {                  if (NULL == body && ARGS_QWORD != c &&
                                   1 == mdoc_isdelim(p)) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! mdoc_word_alloc(m, line, la, p))
                                 return(0);                                  return(0);
                         continue;                          continue;
Line 1169  blk_part_exp(MACRO_PROT_ARGS)
Line 1173  blk_part_exp(MACRO_PROT_ARGS)
   
                 /* Flush out leading punctuation. */                  /* Flush out leading punctuation. */
   
                 if (NULL == head && 1 == mdoc_isdelim(p)) {                  if (NULL == head && ARGS_QWORD != c &&
                                   1 == mdoc_isdelim(p)) {
                         assert(NULL == body);                          assert(NULL == body);
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! mdoc_word_alloc(m, line, la, p))
                                 return(0);                                  return(0);
Line 1305  in_line_argn(MACRO_PROT_ARGS)
Line 1310  in_line_argn(MACRO_PROT_ARGS)
                         break;                          break;
   
                 if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&                  if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&
                                   ARGS_QWORD != c &&
                                 0 == j && 1 == mdoc_isdelim(p)) {                                  0 == j && 1 == mdoc_isdelim(p)) {
                         if ( ! mdoc_word_alloc(m, line, la, p))                          if ( ! mdoc_word_alloc(m, line, la, p))
                                 return(0);                                  return(0);
Line 1330  in_line_argn(MACRO_PROT_ARGS)
Line 1336  in_line_argn(MACRO_PROT_ARGS)
                 }                  }
   
                 if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&                  if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&
                                   ARGS_QWORD != c &&
                                 ! flushed && mdoc_isdelim(p)) {                                  ! flushed && mdoc_isdelim(p)) {
                         if ( ! rew_elem(m, tok))                          if ( ! rew_elem(m, tok))
                                 return(0);                                  return(0);

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

CVSweb