/* $Id: tbl_opts.c,v 1.21 2015/09/26 00:54:04 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mandoc.h"
#include "libmandoc.h"
#include "libroff.h"
#define KEY_DPOINT 0
struct tbl_phrase {
const char *name;
int key;
};
{"decimalpoint", 0},
{"delim", 0},
{"linesize", 0},
{"tab", 0},
{"box", TBL_OPT_BOX},
{"frame", TBL_OPT_BOX},
{"center", TBL_OPT_CENTRE},
{"centre", TBL_OPT_CENTRE},
{"doublebox", TBL_OPT_DBOX},
{"doubleframe", TBL_OPT_DBOX},
{"expand", TBL_OPT_EXPAND},
{"nokeep", TBL_OPT_NOKEEP},
{"nospaces", TBL_OPT_NOSPACE},
{"nowarn", TBL_OPT_NOWARN},
};
static void
{
(*pos)++;
/* Arguments are enclosed in parentheses. */
len = 0;
if (p[*pos] == '(') {
(*pos)++;
len++;
}
switch (key) {
case KEY_DELIM:
want = 2;
break;
case KEY_TAB:
want = 1;
break;
case KEY_LINESIZE:
want = 0;
break;
case KEY_DPOINT:
want = 1;
break;
default:
abort();
}
if (len == 0)
if (p[*pos] == ')')
(*pos)++;
}
/*
* Parse one line of options up to the semicolon.
* and some options are followed by arguments.
*/
void
{
for (;;) {
pos++;
if (p[pos] == ';') {
return;
}
/* Parse one option name. */
len = 0;
len++;
if (len == 0) {
pos++;
continue;
}
/* Look up the option name. */
i = 0;
while (i < KEY_MAXKEYS &&
i++;
if (i == KEY_MAXKEYS) {
continue;
}
/* Handle the option. */
else
}
}