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

Diff for /mandoc/tbl_opts.c between version 1.18 and 1.24

version 1.18, 2015/01/26 13:03:48 version 1.24, 2018/12/14 05:18:03
Line 25 
Line 25 
 #include <string.h>  #include <string.h>
   
 #include "mandoc.h"  #include "mandoc.h"
   #include "tbl.h"
 #include "libmandoc.h"  #include "libmandoc.h"
 #include "libroff.h"  #include "tbl_int.h"
   
 #define KEY_DPOINT      0  #define KEY_DPOINT      0
 #define KEY_DELIM       1  #define KEY_DELIM       1
Line 80  arg(struct tbl_node *tbl, int ln, const char *p, int *
Line 81  arg(struct tbl_node *tbl, int ln, const char *p, int *
   
         switch (key) {          switch (key) {
         case KEY_DELIM:          case KEY_DELIM:
                 mandoc_msg(MANDOCERR_TBLEQN, tbl->parse, ln, *pos, NULL);                  mandoc_msg(MANDOCERR_TBLOPT_EQN,
                       ln, *pos, "%.*s", len, p + *pos);
                 want = 2;                  want = 2;
                 break;                  break;
         case KEY_TAB:          case KEY_TAB:
Line 98  arg(struct tbl_node *tbl, int ln, const char *p, int *
Line 100  arg(struct tbl_node *tbl, int ln, const char *p, int *
                 break;                  break;
         default:          default:
                 abort();                  abort();
                 /* NOTREACHED */  
         }          }
   
         if (len == 0)          if (len == 0)
                 mandoc_msg(MANDOCERR_TBLOPT_NOARG,                  mandoc_msg(MANDOCERR_TBLOPT_NOARG, ln, *pos,
                     tbl->parse, ln, *pos, keys[key].name);                      "%s", keys[key].name);
         else if (want && len != want)          else if (want && len != want)
                 mandoc_vmsg(MANDOCERR_TBLOPT_ARGSZ,                  mandoc_msg(MANDOCERR_TBLOPT_ARGSZ, ln, *pos,
                     tbl->parse, ln, *pos, "%s want %d have %d",                      "%s want %d have %d", keys[key].name, want, len);
                     keys[key].name, want, len);  
   
         *pos += len;          *pos += len;
         if (p[*pos] == ')')          if (p[*pos] == ')')
Line 120  arg(struct tbl_node *tbl, int ln, const char *p, int *
Line 120  arg(struct tbl_node *tbl, int ln, const char *p, int *
  * and some options are followed by arguments.   * and some options are followed by arguments.
  */   */
 void  void
 tbl_option(struct tbl_node *tbl, int ln, const char *p)  tbl_option(struct tbl_node *tbl, int ln, const char *p, int *offs)
 {  {
         int              i, pos, len;          int              i, pos, len;
   
         pos = 0;          pos = *offs;
         for (;;) {          for (;;) {
                 while (p[pos] == ' ' || p[pos] == '\t' || p[pos] == ',')                  while (p[pos] == ' ' || p[pos] == '\t' || p[pos] == ',')
                         pos++;                          pos++;
   
                 if (p[pos] == ';')                  if (p[pos] == ';') {
                           *offs = pos + 1;
                         return;                          return;
                   }
   
                 /* Parse one option name. */                  /* Parse one option name. */
   
Line 139  tbl_option(struct tbl_node *tbl, int ln, const char *p
Line 141  tbl_option(struct tbl_node *tbl, int ln, const char *p
                         len++;                          len++;
   
                 if (len == 0) {                  if (len == 0) {
                         mandoc_vmsg(MANDOCERR_TBLOPT_ALPHA,                          mandoc_msg(MANDOCERR_TBLOPT_ALPHA,
                             tbl->parse, ln, pos, "%c", p[pos]);                              ln, pos, "%c", p[pos]);
                         pos++;                          pos++;
                         continue;                          continue;
                 }                  }
Line 154  tbl_option(struct tbl_node *tbl, int ln, const char *p
Line 156  tbl_option(struct tbl_node *tbl, int ln, const char *p
                         i++;                          i++;
   
                 if (i == KEY_MAXKEYS) {                  if (i == KEY_MAXKEYS) {
                         mandoc_vmsg(MANDOCERR_TBLOPT_BAD, tbl->parse,                          mandoc_msg(MANDOCERR_TBLOPT_BAD,
                             ln, pos, "%.*s", len, p + pos);                              ln, pos, "%.*s", len, p + pos);
                         pos += len;                          pos += len;
                         continue;                          continue;

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.24

CVSweb