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

Diff for /mandoc/eqn.c between version 1.43 and 1.47

version 1.43, 2014/07/04 16:12:08 version 1.47, 2014/09/28 14:05:11
Line 14 
Line 14 
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */   */
 #ifdef HAVE_CONFIG_H  
 #include "config.h"  #include "config.h"
 #endif  
   
   #include <sys/types.h>
   
 #include <assert.h>  #include <assert.h>
 #include <limits.h>  #include <limits.h>
 #include <stdio.h>  #include <stdio.h>
Line 195  static const struct eqnstr eqnfonts[EQNFONT__MAX] = {
Line 195  static const struct eqnstr eqnfonts[EQNFONT__MAX] = {
 };  };
   
 static  const struct eqnstr eqnposs[EQNPOS__MAX] = {  static  const struct eqnstr eqnposs[EQNPOS__MAX] = {
         { "", 0 }, /* EQNPOS_NONE */          { NULL, 0 }, /* EQNPOS_NONE */
         { "over", 4 }, /* EQNPOS_OVER */          { "over", 4 }, /* EQNPOS_OVER */
         { "sup", 3 }, /* EQNPOS_SUP */          { "sup", 3 }, /* EQNPOS_SUP */
           { NULL, 0 }, /* EQNPOS_SUPSUB */
         { "sub", 3 }, /* EQNPOS_SUB */          { "sub", 3 }, /* EQNPOS_SUB */
         { "to", 2 }, /* EQNPOS_TO */          { "to", 2 }, /* EQNPOS_TO */
         { "from", 4 }, /* EQNPOS_FROM */          { "from", 4 }, /* EQNPOS_FROM */
           { NULL, 0 }, /* EQNPOS_FROMTO */
 };  };
   
 static  const struct eqnstr eqnpiles[EQNPILE__MAX] = {  static  const struct eqnstr eqnpiles[EQNPILE__MAX] = {
Line 569  eqn_box(struct eqn_node *ep, struct eqn_box *last)
Line 571  eqn_box(struct eqn_node *ep, struct eqn_box *last)
                 return(EQN_OK);                  return(EQN_OK);
         }          }
   
           /*
            * Positional elements (e.g., over, sub, sup, ...).
            */
         for (i = 0; i < (int)EQNPOS__MAX; i++) {          for (i = 0; i < (int)EQNPOS__MAX; i++) {
                 if ( ! EQNSTREQ(&eqnposs[i], start, sz))                  /* Some elements don't have names (are virtual). */
                   if (NULL == eqnposs[i].name)
                         continue;                          continue;
                   else if ( ! EQNSTREQ(&eqnposs[i], start, sz))
                           continue;
                 if (NULL == last->last) {                  if (NULL == last->last) {
                         EQN_MSG(MANDOCERR_EQNSYNT, ep);                          EQN_MSG(MANDOCERR_EQNSYNT, ep);
                         return(EQN_ERR);                          return(EQN_ERR);
                 }                  }
                 last->last->pos = (enum eqn_post)i;                  /*
                    * If we encounter x sub y sup z, then according to the
                    * eqn manual, we regard this as x subsup y z.
                    */
                   if (EQNPOS_SUP == i &&
                           NULL != last->last->prev &&
                           EQNPOS_SUB == last->last->prev->pos)
                           last->last->prev->pos = EQNPOS_SUBSUP;
                   else if (EQNPOS_TO == i &&
                           NULL != last->last->prev &&
                           EQNPOS_FROM == last->last->prev->pos)
                           last->last->prev->pos = EQNPOS_FROMTO;
                   else
                           last->last->pos = (enum eqn_post)i;
   
                 if (EQN_EOF == (c = eqn_box(ep, last))) {                  if (EQN_EOF == (c = eqn_box(ep, last))) {
                         EQN_MSG(MANDOCERR_EQNEOF, ep);                          EQN_MSG(MANDOCERR_EQNEOF, ep);
                         return(EQN_ERR);                          return(EQN_ERR);
Line 665  eqn_box_alloc(struct eqn_node *ep, struct eqn_box *par
Line 687  eqn_box_alloc(struct eqn_node *ep, struct eqn_box *par
         bp->parent = parent;          bp->parent = parent;
         bp->size = ep->gsize;          bp->size = ep->gsize;
   
         if (NULL == parent->first)          if (NULL != parent->first) {
                 parent->first = bp;  
         else  
                 parent->last->next = bp;                  parent->last->next = bp;
                   bp->prev = parent->last;
           } else
                   parent->first = bp;
   
         parent->last = bp;          parent->last = bp;
         return(bp);          return(bp);
Line 768  again:
Line 791  again:
                         ep->cur++;                          ep->cur++;
         } else {          } else {
                 if (q)                  if (q)
                         EQN_MSG(MANDOCERR_BADQUOTE, ep);                          EQN_MSG(MANDOCERR_ARG_QUOTE, ep);
                 next = strchr(start, '\0');                  next = strchr(start, '\0');
                 *sz = (size_t)(next - start);                  *sz = (size_t)(next - start);
                 ep->cur += *sz;                  ep->cur += *sz;

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.47

CVSweb