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

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

version 1.16, 2009/01/05 14:14:04 version 1.17, 2009/01/05 16:11:14
Line 85  const char *const __mdoc_argnames[MDOC_ARG_MAX] = {   
Line 85  const char *const __mdoc_argnames[MDOC_ARG_MAX] = {   
   
 const   struct mdoc_macro __mdoc_macros[MDOC_MAX] = {  const   struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { NULL, 0 }, /* \" */          { NULL, 0 }, /* \" */
         { NULL, MDOC_PROLOGUE }, /* Dd */          { macro_prologue, MDOC_PROLOGUE }, /* Dd */
         { NULL, MDOC_PROLOGUE }, /* Dt */          { macro_prologue, MDOC_PROLOGUE }, /* Dt */
         { NULL, MDOC_PROLOGUE }, /* Os */          { macro_prologue, MDOC_PROLOGUE }, /* Os */
         { macro_scoped, 0 }, /* Sh */          { macro_scoped, 0 }, /* Sh */
         { macro_scoped, 0 }, /* Ss */          { macro_scoped, 0 }, /* Ss */
         { macro_text, 0 }, /* Pp */          { macro_text, 0 }, /* Pp */
Line 97  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
Line 97  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { macro_close_explicit, 0 }, /* Ed */          { macro_close_explicit, 0 }, /* Ed */
         { macro_scoped, MDOC_EXPLICIT }, /* Bl */          { macro_scoped, MDOC_EXPLICIT }, /* Bl */
         { macro_close_explicit, 0 }, /* El */          { macro_close_explicit, 0 }, /* El */
         { NULL, 0 }, /* It */          { macro_scoped, MDOC_NESTED }, /* It */
         { macro_text, MDOC_CALLABLE }, /* Ad */          { macro_text, MDOC_CALLABLE }, /* Ad */
         { macro_constant, 0 }, /* An */          { macro_constant, 0 }, /* An */
         { macro_text, MDOC_CALLABLE }, /* Ar */          { macro_text, MDOC_CALLABLE }, /* Ar */
Line 116  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
Line 116  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { macro_constant, 0 }, /* In */          { macro_constant, 0 }, /* In */
         { macro_text, MDOC_CALLABLE }, /* Li */          { macro_text, MDOC_CALLABLE }, /* Li */
         { macro_constant, 0 }, /* Nd */          { macro_constant, 0 }, /* Nd */
         { NULL, 0 }, /* Nm */          { macro_text, MDOC_CALLABLE }, /* Nm */
         { macro_scoped_line, MDOC_CALLABLE }, /* Op */          { macro_scoped_line, MDOC_CALLABLE }, /* Op */
         { macro_obsolete, 0 }, /* Ot */          { macro_obsolete, 0 }, /* Ot */
         { macro_text, MDOC_CALLABLE }, /* Pa */          { macro_text, MDOC_CALLABLE }, /* Pa */
Line 136  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
Line 136  const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
         { macro_constant, MDOC_QUOTABLE }, /* %R */          { macro_constant, MDOC_QUOTABLE }, /* %R */
         { macro_constant, MDOC_QUOTABLE }, /* %T */          { macro_constant, MDOC_QUOTABLE }, /* %T */
         { macro_constant, MDOC_QUOTABLE }, /* %V */          { macro_constant, MDOC_QUOTABLE }, /* %V */
         { NULL, 0 }, /* Ac */          { macro_close_explicit, MDOC_CALLABLE }, /* Ac */
         { NULL, 0 }, /* Ao */          { macro_constant_scoped, MDOC_CALLABLE }, /* Ao */
         { macro_scoped_line, MDOC_CALLABLE }, /* Aq */          { macro_scoped_line, MDOC_CALLABLE }, /* Aq */
         { macro_constant, 0 }, /* At */          { macro_constant, 0 }, /* At */
         { NULL, 0 }, /* Bc */          { macro_close_explicit, MDOC_CALLABLE }, /* Bc */
         { macro_scoped, MDOC_EXPLICIT }, /* Bf */          { macro_scoped, MDOC_EXPLICIT }, /* Bf */
         { NULL, 0 }, /* Bo */          { macro_constant_scoped, MDOC_CALLABLE }, /* Bo */
         { macro_scoped_line, MDOC_CALLABLE }, /* Bq */          { macro_scoped_line, MDOC_CALLABLE }, /* Bq */
         { macro_constant_delimited, 0 }, /* Bsx */          { macro_constant_delimited, 0 }, /* Bsx */
         { macro_constant_delimited, 0 }, /* Bx */          { macro_constant_delimited, 0 }, /* Bx */
         { macro_constant, 0 }, /* Db */          { macro_constant, 0 }, /* Db */
         { NULL, 0 }, /* Dc */          { macro_close_explicit, MDOC_CALLABLE }, /* Dc */
         { NULL, 0 }, /* Do */          { macro_constant_scoped, MDOC_CALLABLE }, /* Do */
         { macro_scoped_line, MDOC_CALLABLE }, /* Dq */          { macro_scoped_line, MDOC_CALLABLE }, /* Dq */
         { NULL, 0 }, /* Ec */          { macro_close_explicit, MDOC_CALLABLE }, /* Ec */
         { macro_close_explicit, 0 }, /* Ef */          { macro_close_explicit, 0 }, /* Ef */
         { macro_text, MDOC_CALLABLE }, /* Em */          { macro_text, MDOC_CALLABLE }, /* Em */
         { NULL, 0 }, /* Eo */          { macro_constant_scoped, MDOC_CALLABLE }, /* Eo */
         { macro_constant_delimited, 0 }, /* Fx */          { macro_constant_delimited, 0 }, /* Fx */
         { macro_text, 0 }, /* Ms */          { macro_text, 0 }, /* Ms */
         { macro_constant_delimited, MDOC_CALLABLE }, /* No */          { macro_constant_delimited, MDOC_CALLABLE }, /* No */
         { macro_constant_delimited, MDOC_CALLABLE }, /* Ns */          { macro_constant_delimited, MDOC_CALLABLE }, /* Ns */
         { macro_constant_delimited, 0 }, /* Nx */          { macro_constant_delimited, 0 }, /* Nx */
         { macro_constant_delimited, 0 }, /* Ox */          { macro_constant_delimited, 0 }, /* Ox */
         { NULL, 0 }, /* Pc */          { macro_close_explicit, MDOC_CALLABLE }, /* Pc */
         { macro_constant, 0 }, /* Pf */          { macro_constant, 0 }, /* Pf */
         { NULL, 0 }, /* Po */          { macro_constant_scoped, MDOC_CALLABLE }, /* Po */
         { macro_scoped_line, MDOC_CALLABLE }, /* Pq */          { macro_scoped_line, MDOC_CALLABLE }, /* Pq */
         { NULL, 0 }, /* Qc */          { macro_close_explicit, MDOC_CALLABLE }, /* Qc */
         { macro_scoped_line, MDOC_CALLABLE }, /* Ql */          { macro_scoped_line, MDOC_CALLABLE }, /* Ql */
         { NULL, 0 }, /* Qo */          { macro_constant_scoped, MDOC_CALLABLE }, /* Qo */
         { macro_scoped_line, MDOC_CALLABLE }, /* Qq */          { macro_scoped_line, MDOC_CALLABLE }, /* Qq */
         { macro_scoped, MDOC_EXPLICIT }, /* Re */          { macro_scoped, MDOC_EXPLICIT }, /* Re */
         { macro_scoped, MDOC_EXPLICIT }, /* Rs */          { macro_scoped, MDOC_EXPLICIT }, /* Rs */
         { NULL, 0 }, /* Sc */          { macro_close_explicit, MDOC_CALLABLE }, /* Sc */
         { NULL, 0 }, /* So */          { macro_constant_scoped, MDOC_CALLABLE }, /* So */
         { macro_scoped_line, MDOC_CALLABLE }, /* Sq */          { macro_scoped_line, MDOC_CALLABLE }, /* Sq */
         { macro_constant, 0 }, /* Sm */          { macro_constant, 0 }, /* Sm */
         { macro_text, MDOC_CALLABLE }, /* Sx */          { macro_text, MDOC_CALLABLE }, /* Sx */
         { macro_text, MDOC_CALLABLE }, /* Sy */          { macro_text, MDOC_CALLABLE }, /* Sy */
         { macro_text, MDOC_CALLABLE }, /* Tn */          { macro_text, MDOC_CALLABLE }, /* Tn */
         { macro_constant_delimited, 0 }, /* Ux */          { macro_constant_delimited, 0 }, /* Ux */
         { NULL, 0 }, /* Xc */          { macro_close_explicit, MDOC_CALLABLE }, /* Xc */
         { NULL, 0 }, /* Xo */          { macro_constant_scoped, MDOC_CALLABLE }, /* Xo */
         { NULL, 0 }, /* Fo */          { macro_scoped, MDOC_EXPLICIT }, /* Fo */ /* XXX - supposed to be (but isn't) callable. */
         { NULL, 0 }, /* Fc */          { macro_close_explicit, 0 }, /* Fc */ /* XXX - supposed to be (but isn't) callable. */
         { NULL, 0 }, /* Oo */          { macro_constant_scoped, MDOC_CALLABLE }, /* Oo */
         { NULL, 0 }, /* Oc */          { macro_close_explicit, MDOC_CALLABLE }, /* Oc */
         { NULL, 0 }, /* Bk */          { macro_scoped, MDOC_EXPLICIT }, /* Bk */
         { NULL, 0 }, /* Ek */          { macro_close_explicit, 0 }, /* Ek */
         { macro_constant, 0 }, /* Bt */          { macro_constant, 0 }, /* Bt */
         { macro_constant, 0 }, /* Hf */          { macro_constant, 0 }, /* Hf */
         { macro_obsolete, 0 }, /* Fr */          { macro_obsolete, 0 }, /* Fr */
Line 326  int
Line 326  int
 mdoc_macro(struct mdoc *mdoc, int tok, int ppos, int *pos, char *buf)  mdoc_macro(struct mdoc *mdoc, int tok, int ppos, int *pos, char *buf)
 {  {
   
         if (MDOC_PROLOGUE & mdoc_macros[tok].flags &&          if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) &&
                         SEC_PROLOGUE == mdoc->sec_lastn)                          SEC_PROLOGUE == mdoc->sec_lastn)
                 return(macro_prologue(mdoc, tok, ppos, pos, buf));  
   
         if (SEC_PROLOGUE == mdoc->sec_lastn)  
                 return(mdoc_err(mdoc, tok, ppos, ERR_SEC_PROLOGUE));                  return(mdoc_err(mdoc, tok, ppos, ERR_SEC_PROLOGUE));
   
         if (NULL == (mdoc_macros[tok].fp)) {          if (NULL == (mdoc_macros[tok].fp)) {
Line 369  mdoc_node_append(struct mdoc *mdoc, int pos, struct md
Line 366  mdoc_node_append(struct mdoc *mdoc, int pos, struct md
                 nn = mdoc_macronames[p->data.head.tok];                  nn = mdoc_macronames[p->data.head.tok];
                 nt = "head";                  nt = "head";
                 break;                  break;
           case (MDOC_TAIL):
                   nn = mdoc_macronames[p->data.tail.tok];
                   nt = "tail";
                   break;
         case (MDOC_BLOCK):          case (MDOC_BLOCK):
                 nn = mdoc_macronames[p->data.block.tok];                  nn = mdoc_macronames[p->data.block.tok];
                 nt = "block";                  nt = "block";
Line 403  mdoc_node_append(struct mdoc *mdoc, int pos, struct md
Line 404  mdoc_node_append(struct mdoc *mdoc, int pos, struct md
                 on = mdoc_macronames[mdoc->last->data.head.tok];                  on = mdoc_macronames[mdoc->last->data.head.tok];
                 ot = "head";                  ot = "head";
                 break;                  break;
           case (MDOC_TAIL):
                   on = mdoc_macronames[mdoc->last->data.tail.tok];
                   ot = "tail";
                   break;
         case (MDOC_BLOCK):          case (MDOC_BLOCK):
                 on = mdoc_macronames[mdoc->last->data.block.tok];                  on = mdoc_macronames[mdoc->last->data.block.tok];
                 ot = "block";                  ot = "block";
Line 437  mdoc_node_append(struct mdoc *mdoc, int pos, struct md
Line 442  mdoc_node_append(struct mdoc *mdoc, int pos, struct md
   
   
 void  void
   mdoc_tail_alloc(struct mdoc *mdoc, int pos, int tok)
   {
           struct mdoc_node *p;
   
           assert(mdoc->first);
           assert(mdoc->last);
   
           p = xcalloc(1, sizeof(struct mdoc_node));
   
           p->type = MDOC_TAIL;
           p->data.tail.tok = tok;
   
           mdoc_node_append(mdoc, pos, p);
   }
   
   
   void
 mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok)  mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok)
 {  {
         struct mdoc_node *p;          struct mdoc_node *p;
Line 496  mdoc_elem_alloc(struct mdoc *mdoc, int pos, int tok, 
Line 518  mdoc_elem_alloc(struct mdoc *mdoc, int pos, int tok, 
         p = xcalloc(1, sizeof(struct mdoc_node));          p = xcalloc(1, sizeof(struct mdoc_node));
         p->type = MDOC_ELEM;          p->type = MDOC_ELEM;
         p->data.elem.tok = tok;          p->data.elem.tok = tok;
         /* FIXME: freeing of params... */  
         p->data.elem.argc = argsz;          p->data.elem.argc = argsz;
         p->data.elem.argv = argdup(argsz, args);          p->data.elem.argv = argdup(argsz, args);
   

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

CVSweb