and some cleanup; no functional change, minus 70 lines.
-/* $Id: libman.h,v 1.64 2014/11/03 23:18:39 schwarze Exp $ */
+/* $Id: libman.h,v 1.65 2014/11/28 05:51:32 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
char *buf
struct man_macro {
- int (*fp)(MACRO_PROT_ARGS);
+ void (*fp)(MACRO_PROT_ARGS);
int flags;
#define MAN_SCOPED (1 << 0)
#define MAN_EXPLICIT (1 << 1) /* See blk_imp(). */
__BEGIN_DECLS
-int man_word_alloc(struct man *, int, int, const char *);
+void man_word_alloc(struct man *, int, int, const char *);
void man_word_append(struct man *, const char *);
-int man_block_alloc(struct man *, int, int, enum mant);
-int man_head_alloc(struct man *, int, int, enum mant);
-int man_tail_alloc(struct man *, int, int, enum mant);
-int man_body_alloc(struct man *, int, int, enum mant);
-int man_elem_alloc(struct man *, int, int, enum mant);
+void man_block_alloc(struct man *, int, int, enum mant);
+void man_head_alloc(struct man *, int, int, enum mant);
+void man_body_alloc(struct man *, int, int, enum mant);
+void man_elem_alloc(struct man *, int, int, enum mant);
void man_node_delete(struct man *, struct man_node *);
void man_hash_init(void);
enum mant man_hash_find(const char *);
-int man_macroend(struct man *);
-int man_valid_post(struct man *);
-int man_unscope(struct man *, const struct man_node *);
+void man_macroend(struct man *);
+void man_valid_post(struct man *);
+void man_unscope(struct man *, const struct man_node *);
__END_DECLS
-/* $Id: man.c,v 1.143 2014/11/19 03:08:17 schwarze Exp $ */
+/* $Id: man.c,v 1.144 2014/11/28 05:51:32 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
static struct man_node *man_node_alloc(struct man *, int, int,
enum man_type, enum mant);
-static int man_node_append(struct man *,
- struct man_node *);
+static void man_node_append(struct man *, struct man_node *);
static void man_node_free(struct man_node *);
static void man_node_unlink(struct man *,
struct man_node *);
static int man_pmacro(struct man *, int, char *, int);
static void man_free1(struct man *);
static void man_alloc1(struct man *);
-static int man_descope(struct man *, int, int);
+static void man_descope(struct man *, int, int);
const struct man_node *
man_endparse(struct man *man)
{
- return(man_macroend(man));
+ man_macroend(man);
+ return(1);
}
int
if (man->first)
man_node_delete(man, man->first);
- if (man->meta.title)
- free(man->meta.title);
- if (man->meta.source)
- free(man->meta.source);
- if (man->meta.date)
- free(man->meta.date);
- if (man->meta.vol)
- free(man->meta.vol);
- if (man->meta.msec)
- free(man->meta.msec);
+ free(man->meta.title);
+ free(man->meta.source);
+ free(man->meta.date);
+ free(man->meta.vol);
+ free(man->meta.msec);
}
static void
}
-static int
+static void
man_node_append(struct man *man, struct man_node *p)
{
assert(man->last);
assert(man->first);
- assert(MAN_ROOT != p->type);
+ assert(p->type != MAN_ROOT);
switch (man->next) {
case MAN_NEXT_SIBLING:
man->flags &= ~MAN_LITERAL;
break;
case MAN_HEAD:
- assert(MAN_BLOCK == p->parent->type);
+ assert(p->parent->type == MAN_BLOCK);
p->parent->head = p;
break;
- case MAN_TAIL:
- assert(MAN_BLOCK == p->parent->type);
- p->parent->tail = p;
- break;
case MAN_BODY:
- assert(MAN_BLOCK == p->parent->type);
+ assert(p->parent->type == MAN_BLOCK);
p->parent->body = p;
break;
default:
case MAN_TBL:
/* FALLTHROUGH */
case MAN_TEXT:
- if ( ! man_valid_post(man))
- return(0);
+ man_valid_post(man);
break;
default:
break;
}
-
- return(1);
}
static struct man_node *
p->type = type;
p->tok = tok;
- if (MAN_NEWLINE & man->flags)
+ if (man->flags & MAN_NEWLINE)
p->flags |= MAN_LINE;
man->flags &= ~MAN_NEWLINE;
return(p);
}
-int
+void
man_elem_alloc(struct man *man, int line, int pos, enum mant tok)
{
struct man_node *p;
p = man_node_alloc(man, line, pos, MAN_ELEM, tok);
- if ( ! man_node_append(man, p))
- return(0);
- man->next = MAN_NEXT_CHILD;
- return(1);
-}
-
-int
-man_tail_alloc(struct man *man, int line, int pos, enum mant tok)
-{
- struct man_node *p;
-
- p = man_node_alloc(man, line, pos, MAN_TAIL, tok);
- if ( ! man_node_append(man, p))
- return(0);
+ man_node_append(man, p);
man->next = MAN_NEXT_CHILD;
- return(1);
}
-int
+void
man_head_alloc(struct man *man, int line, int pos, enum mant tok)
{
struct man_node *p;
p = man_node_alloc(man, line, pos, MAN_HEAD, tok);
- if ( ! man_node_append(man, p))
- return(0);
+ man_node_append(man, p);
man->next = MAN_NEXT_CHILD;
- return(1);
}
-int
+void
man_body_alloc(struct man *man, int line, int pos, enum mant tok)
{
struct man_node *p;
p = man_node_alloc(man, line, pos, MAN_BODY, tok);
- if ( ! man_node_append(man, p))
- return(0);
+ man_node_append(man, p);
man->next = MAN_NEXT_CHILD;
- return(1);
}
-int
+void
man_block_alloc(struct man *man, int line, int pos, enum mant tok)
{
struct man_node *p;
p = man_node_alloc(man, line, pos, MAN_BLOCK, tok);
- if ( ! man_node_append(man, p))
- return(0);
+ man_node_append(man, p);
man->next = MAN_NEXT_CHILD;
- return(1);
}
-int
+void
man_word_alloc(struct man *man, int line, int pos, const char *word)
{
struct man_node *n;
n = man_node_alloc(man, line, pos, MAN_TEXT, MAN_MAX);
n->string = roff_strdup(man->roff, word);
-
- if ( ! man_node_append(man, n))
- return(0);
-
+ man_node_append(man, n);
man->next = MAN_NEXT_SIBLING;
- return(1);
}
void
man_node_free(struct man_node *p)
{
- if (p->string)
- free(p->string);
+ free(p->string);
free(p);
}
n->eqn = ep;
if (ep->ln > man->last->line)
n->flags |= MAN_LINE;
-
- if ( ! man_node_append(man, n))
- return(0);
-
+ man_node_append(man, n);
man->next = MAN_NEXT_SIBLING;
- return(man_descope(man, ep->ln, ep->pos));
+ man_descope(man, ep->ln, ep->pos);
+ return(1);
}
int
n = man_node_alloc(man, sp->line, 0, MAN_TBL, MAN_MAX);
n->span = sp;
-
- if ( ! man_node_append(man, n))
- return(0);
-
+ man_node_append(man, n);
man->next = MAN_NEXT_SIBLING;
- return(man_descope(man, sp->line, 0));
+ man_descope(man, sp->line, 0);
+ return(1);
}
-static int
+static void
man_descope(struct man *man, int line, int offs)
{
/*
* out the block scope (also if applicable).
*/
- if (MAN_ELINE & man->flags) {
+ if (man->flags & MAN_ELINE) {
man->flags &= ~MAN_ELINE;
- if ( ! man_unscope(man, man->last->parent))
- return(0);
+ man_unscope(man, man->last->parent);
}
-
- if ( ! (MAN_BLINE & man->flags))
- return(1);
+ if ( ! (man->flags & MAN_BLINE))
+ return;
man->flags &= ~MAN_BLINE;
-
- if ( ! man_unscope(man, man->last->parent))
- return(0);
- return(man_body_alloc(man, line, offs, man->last->tok));
+ man_unscope(man, man->last->parent);
+ man_body_alloc(man, line, offs, man->last->tok);
}
static int
/* Literal free-form text whitespace is preserved. */
- if (MAN_LITERAL & man->flags) {
- if ( ! man_word_alloc(man, line, offs, buf + offs))
- return(0);
- return(man_descope(man, line, offs));
+ if (man->flags & MAN_LITERAL) {
+ man_word_alloc(man, line, offs, buf + offs);
+ man_descope(man, line, offs);
+ return(1);
}
- for (i = offs; ' ' == buf[i]; i++)
+ for (i = offs; buf[i] == ' '; i++)
/* Skip leading whitespace. */ ;
/*
* but add a single vertical space elsewhere.
*/
- if ('\0' == buf[i]) {
+ if (buf[i] == '\0') {
/* Allocate a blank entry. */
- if (MAN_SH != man->last->tok &&
- MAN_SS != man->last->tok) {
- if ( ! man_elem_alloc(man, line, offs, MAN_sp))
- return(0);
+ if (man->last->tok != MAN_SH &&
+ man->last->tok != MAN_SS) {
+ man_elem_alloc(man, line, offs, MAN_sp);
man->next = MAN_NEXT_SIBLING;
}
return(1);
buf[i] = '\0';
}
-
- if ( ! man_word_alloc(man, line, offs, buf + offs))
- return(0);
+ man_word_alloc(man, line, offs, buf + offs);
/*
* End-of-sentence check. If the last character is an unescaped
if (mandoc_eos(buf, (size_t)i))
man->last->flags |= MAN_EOS;
- return(man_descope(man, line, offs));
+ man_descope(man, line, offs);
+ return(1);
}
static int
/* Jump to the next non-whitespace word. */
- while (buf[offs] && ' ' == buf[offs])
+ while (buf[offs] && buf[offs] == ' ')
offs++;
/*
* into the parser as "text", so we only warn about spaces here.
*/
- if ('\0' == buf[offs] && ' ' == buf[offs - 1])
+ if (buf[offs] == '\0' && buf[offs - 1] == ' ')
mandoc_msg(MANDOCERR_SPACE_EOL, man->parse,
ln, offs - 1, NULL);
* macros---they don't print text---so we let those slip by.
*/
- if ( ! (MAN_NSCOPED & man_macros[tok].flags) &&
+ if ( ! (man_macros[tok].flags & MAN_NSCOPED) &&
man->flags & MAN_ELINE) {
n = man->last;
assert(MAN_TEXT != n->type);
/* Remove repeated NSCOPED macros causing ELINE. */
- if (MAN_NSCOPED & man_macros[n->tok].flags)
+ if (man_macros[n->tok].flags & MAN_NSCOPED)
n = n->parent;
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, n->line,
* Remove prior BLINE macro that is being clobbered.
*/
if ((man->flags & MAN_BLINE) &&
- (MAN_BSCOPE & man_macros[tok].flags)) {
+ (man_macros[tok].flags & MAN_BSCOPE)) {
n = man->last;
/* Might be a text node like 8 in
* .TP 8
* .SH foo
*/
- if (MAN_TEXT == n->type)
+ if (n->type == MAN_TEXT)
n = n->parent;
/* Remove element that didn't end BLINE, if any. */
- if ( ! (MAN_BSCOPE & man_macros[n->tok].flags))
+ if ( ! (man_macros[n->tok].flags & MAN_BSCOPE))
n = n->parent;
- assert(MAN_HEAD == n->type);
+ assert(n->type == MAN_HEAD);
n = n->parent;
- assert(MAN_BLOCK == n->type);
- assert(MAN_SCOPED & man_macros[n->tok].flags);
+ assert(n->type == MAN_BLOCK);
+ assert(man_macros[n->tok].flags & MAN_SCOPED);
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse, n->line,
n->pos, "%s breaks %s", man_macronames[tok],
/* Call to handler... */
assert(man_macros[tok].fp);
- if ( ! (*man_macros[tok].fp)(man, tok, ln, ppos, &offs, buf))
- return(0);
+ (*man_macros[tok].fp)(man, tok, ln, ppos, &offs, buf);
/* In quick mode (for mandocdb), abort after the NAME section. */
- if (man->quick && MAN_SH == tok) {
+ if (man->quick && tok == MAN_SH) {
n = man->last;
- if (MAN_BODY == n->type &&
+ if (n->type == MAN_BODY &&
strcmp(n->prev->child->string, "NAME"))
return(2);
}
man_macros[tok].flags & MAN_NSCOPED)
return(1);
- assert(MAN_BLINE & man->flags);
+ assert(man->flags & MAN_BLINE);
man->flags &= ~MAN_BLINE;
- if ( ! man_unscope(man, man->last->parent))
- return(0);
- return(man_body_alloc(man, ln, ppos, man->last->tok));
+ man_unscope(man, man->last->parent);
+ man_body_alloc(man, ln, ppos, man->last->tok);
+ return(1);
}
/*
char *cp;
size_t sz;
- if (MAN_TEXT != n->type) {
+ if (n->type != MAN_TEXT) {
for (n = n->child; n; n = n->next)
man_deroff(dest, n);
return;
-/* $Id: man.h,v 1.65 2014/06/20 23:02:31 schwarze Exp $ */
+/* $Id: man.h,v 1.66 2014/11/28 05:51:32 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
MAN_BLOCK,
MAN_HEAD,
MAN_BODY,
- MAN_TAIL,
MAN_TBL,
MAN_EQN
};
-/* $Id: man_macro.c,v 1.90 2014/11/03 23:18:39 schwarze Exp $ */
+/* $Id: man_macro.c,v 1.91 2014/11/28 05:51:32 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
REW_HALT
};
-static int blk_close(MACRO_PROT_ARGS);
-static int blk_exp(MACRO_PROT_ARGS);
-static int blk_imp(MACRO_PROT_ARGS);
-static int in_line_eoln(MACRO_PROT_ARGS);
+static void blk_close(MACRO_PROT_ARGS);
+static void blk_exp(MACRO_PROT_ARGS);
+static void blk_imp(MACRO_PROT_ARGS);
+static void in_line_eoln(MACRO_PROT_ARGS);
static int man_args(struct man *, int,
int *, char *, char **);
-static int rew_scope(enum man_type,
+static void rew_scope(enum man_type,
struct man *, enum mant);
static enum rew rew_dohalt(enum mant, enum man_type,
const struct man_node *);
const struct man_macro * const man_macros = __man_macros;
-int
+void
man_unscope(struct man *man, const struct man_node *to)
{
struct man_node *n;
man->last = n;
n = n->parent;
- if ( ! man_valid_post(man))
- return(0);
+ man_valid_post(man);
}
/*
man->next = (man->last == to) ?
MAN_NEXT_CHILD : MAN_NEXT_SIBLING;
-
- return(1);
}
static enum rew
rew_block(enum mant ntok, enum man_type type, const struct man_node *n)
{
- if (MAN_BLOCK == type && ntok == n->parent->tok &&
- MAN_BODY == n->parent->type)
+ if (type == MAN_BLOCK && ntok == n->parent->tok &&
+ n->parent->type == MAN_BODY)
return(REW_REWIND);
return(ntok == n->tok ? REW_HALT : REW_NOHALT);
}
* for example, the `SH' macro will close out any intervening `SS'
* scopes. When a scope is closed, it must be validated and actioned.
*/
-static int
+static void
rew_scope(enum man_type type, struct man *man, enum mant tok)
{
struct man_node *n;
*/
c = rew_dohalt(tok, type, n);
if (REW_HALT == c)
- return(1);
+ return;
if (REW_REWIND == c)
break;
}
* Rewind until the current point. Warn if we're a roff
* instruction that's mowing over explicit scopes.
*/
- assert(n);
- return(man_unscope(man, n));
+ man_unscope(man, n);
}
/*
* Close out a generic explicit macro.
*/
-int
+void
blk_close(MACRO_PROT_ARGS)
{
enum mant ntok;
}
for (nn = man->last->parent; nn; nn = nn->parent)
- if (ntok == nn->tok && MAN_BLOCK == nn->type)
+ if (nn->tok == ntok && nn->type == MAN_BLOCK)
break;
- if (NULL == nn) {
+ if (nn == NULL) {
mandoc_msg(MANDOCERR_BLK_NOTOPEN, man->parse,
line, ppos, man_macronames[tok]);
- if ( ! rew_scope(MAN_BLOCK, man, MAN_PP))
- return(0);
+ rew_scope(MAN_BLOCK, man, MAN_PP);
} else
man_unscope(man, nn);
-
- return(1);
}
-int
+void
blk_exp(MACRO_PROT_ARGS)
{
struct man_node *n;
int la;
char *p;
- /* Close out prior implicit scopes. */
-
- if ( ! rew_scope(MAN_BLOCK, man, tok))
- return(0);
-
- if ( ! man_block_alloc(man, line, ppos, tok))
- return(0);
- if ( ! man_head_alloc(man, line, ppos, tok))
- return(0);
+ rew_scope(MAN_BLOCK, man, tok);
+ man_block_alloc(man, line, ppos, tok);
+ man_head_alloc(man, line, ppos, tok);
for (;;) {
la = *pos;
if ( ! man_args(man, line, pos, buf, &p))
break;
- if ( ! man_word_alloc(man, line, la, p))
- return(0);
+ man_word_alloc(man, line, la, p);
}
assert(man);
assert(tok != MAN_MAX);
- for (n = man->last; n; n = n->parent) {
- if (n->tok != tok)
- continue;
- assert(MAN_HEAD == n->type);
- man_unscope(man, n);
- break;
- }
+ for (n = man->last; n; n = n->parent)
+ if (n->tok == tok) {
+ assert(n->type == MAN_HEAD);
+ man_unscope(man, n);
+ break;
+ }
- return(man_body_alloc(man, line, ppos, tok));
+ man_body_alloc(man, line, ppos, tok);
}
/*
* scopes, such as `SH' closing out an `SS', are defined in the rew
* routines.
*/
-int
+void
blk_imp(MACRO_PROT_ARGS)
{
int la;
char *p;
struct man_node *n;
- /* Close out prior scopes. */
-
- if ( ! rew_scope(MAN_BODY, man, tok))
- return(0);
- if ( ! rew_scope(MAN_BLOCK, man, tok))
- return(0);
-
- /* Allocate new block & head scope. */
-
- if ( ! man_block_alloc(man, line, ppos, tok))
- return(0);
- if ( ! man_head_alloc(man, line, ppos, tok))
- return(0);
-
+ rew_scope(MAN_BODY, man, tok);
+ rew_scope(MAN_BLOCK, man, tok);
+ man_block_alloc(man, line, ppos, tok);
+ man_head_alloc(man, line, ppos, tok);
n = man->last;
/* Add line arguments. */
la = *pos;
if ( ! man_args(man, line, pos, buf, &p))
break;
- if ( ! man_word_alloc(man, line, la, p))
- return(0);
+ man_word_alloc(man, line, la, p);
}
/* Close out head and open body (unless MAN_SCOPE). */
- if (MAN_SCOPED & man_macros[tok].flags) {
+ if (man_macros[tok].flags & MAN_SCOPED) {
/* If we're forcing scope (`TP'), keep it open. */
- if (MAN_FSCOPED & man_macros[tok].flags) {
+ if (man_macros[tok].flags & MAN_FSCOPED) {
man->flags |= MAN_BLINE;
- return(1);
+ return;
} else if (n == man->last) {
man->flags |= MAN_BLINE;
- return(1);
+ return;
}
}
-
- if ( ! rew_scope(MAN_HEAD, man, tok))
- return(0);
- return(man_body_alloc(man, line, ppos, tok));
+ rew_scope(MAN_HEAD, man, tok);
+ man_body_alloc(man, line, ppos, tok);
}
-int
+void
in_line_eoln(MACRO_PROT_ARGS)
{
int la;
char *p;
struct man_node *n;
- if ( ! man_elem_alloc(man, line, ppos, tok))
- return(0);
-
+ man_elem_alloc(man, line, ppos, tok);
n = man->last;
for (;;) {
if (man_macros[tok].flags & MAN_JOIN &&
man->last->type == MAN_TEXT)
man_word_append(man, p);
- else if ( ! man_word_alloc(man, line, la, p))
- return(0);
+ else
+ man_word_alloc(man, line, la, p);
}
/*
* waiting for terms to load into our context.
*/
- if (n == man->last && MAN_SCOPED & man_macros[tok].flags) {
- assert( ! (MAN_NSCOPED & man_macros[tok].flags));
+ if (n == man->last && man_macros[tok].flags & MAN_SCOPED) {
+ assert( ! (man_macros[tok].flags & MAN_NSCOPED));
man->flags |= MAN_ELINE;
- return(1);
+ return;
}
- assert(MAN_ROOT != man->last->type);
+ assert(man->last->type != MAN_ROOT);
man->next = MAN_NEXT_SIBLING;
/*
break;
if (man->last->type == MAN_ROOT)
break;
- if ( ! man_valid_post(man))
- return(0);
+ man_valid_post(man);
}
assert(man->last);
* Same here regarding whether we're back at the root.
*/
- if (man->last->type != MAN_ROOT && ! man_valid_post(man))
- return(0);
-
- return(1);
+ if (man->last->type != MAN_ROOT)
+ man_valid_post(man);
}
-int
+void
man_macroend(struct man *man)
{
- return(man_unscope(man, man->first));
+ man_unscope(man, man->first);
}
static int
-/* $Id: man_validate.c,v 1.106 2014/08/10 23:54:41 schwarze Exp $ */
+/* $OpenBSD$ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
#define CHKARGS struct man *man, struct man_node *n
-typedef int (*v_check)(CHKARGS);
-
-static int check_eq0(CHKARGS);
-static int check_eq2(CHKARGS);
-static int check_le1(CHKARGS);
-static int check_le5(CHKARGS);
-static int check_par(CHKARGS);
-static int check_part(CHKARGS);
-static int check_root(CHKARGS);
-static int check_text(CHKARGS);
-
-static int post_AT(CHKARGS);
-static int post_IP(CHKARGS);
-static int post_vs(CHKARGS);
-static int post_fi(CHKARGS);
-static int post_ft(CHKARGS);
-static int post_nf(CHKARGS);
-static int post_TH(CHKARGS);
-static int post_UC(CHKARGS);
-static int post_UR(CHKARGS);
+typedef void (*v_check)(CHKARGS);
+
+static void check_eq0(CHKARGS);
+static void check_eq2(CHKARGS);
+static void check_le1(CHKARGS);
+static void check_le5(CHKARGS);
+static void check_par(CHKARGS);
+static void check_part(CHKARGS);
+static void check_root(CHKARGS);
+static void check_text(CHKARGS);
+
+static void post_AT(CHKARGS);
+static void post_IP(CHKARGS);
+static void post_vs(CHKARGS);
+static void post_fi(CHKARGS);
+static void post_ft(CHKARGS);
+static void post_nf(CHKARGS);
+static void post_TH(CHKARGS);
+static void post_UC(CHKARGS);
+static void post_UR(CHKARGS);
static v_check man_valids[MAN_MAX] = {
post_vs, /* br */
};
-int
+void
man_valid_post(struct man *man)
{
struct man_node *n;
n = man->last;
if (n->flags & MAN_VALID)
- return(1);
+ return;
n->flags |= MAN_VALID;
switch (n->type) {
case MAN_TEXT:
- return(check_text(man, n));
+ check_text(man, n);
+ break;
case MAN_ROOT:
- return(check_root(man, n));
+ check_root(man, n);
+ break;
case MAN_EQN:
/* FALLTHROUGH */
case MAN_TBL:
- return(1);
+ break;
default:
cp = man_valids + n->tok;
- return(*cp ? (*cp)(man, n) : 1);
+ if (*cp)
+ (*cp)(man, n);
+ break;
}
}
-static int
+static void
check_root(CHKARGS)
{
man->meta.date = man->quick ? mandoc_strdup("") :
mandoc_normdate(man->parse, NULL, n->line, n->pos);
}
-
- return(1);
}
-static int
+static void
check_text(CHKARGS)
{
char *cp, *p;
if (MAN_LITERAL & man->flags)
- return(1);
+ return;
cp = n->string;
for (p = cp; NULL != (p = strchr(p, '\t')); p++)
mandoc_msg(MANDOCERR_FI_TAB, man->parse,
n->line, n->pos + (p - cp), NULL);
- return(1);
}
#define INEQ_DEFINE(x, ineq, name) \
-static int \
+static void \
check_##name(CHKARGS) \
{ \
if (n->nchild ineq (x)) \
- return(1); \
+ return; \
mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line, n->pos, \
"line arguments %s %d (have %d)", \
#ineq, (x), n->nchild); \
- return(1); \
}
INEQ_DEFINE(0, ==, eq0)
INEQ_DEFINE(1, <=, le1)
INEQ_DEFINE(5, <=, le5)
-static int
+static void
post_UR(CHKARGS)
{
if (MAN_HEAD == n->type && 1 != n->nchild)
mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line,
n->pos, "line arguments eq 1 (have %d)", n->nchild);
-
- return(check_part(man, n));
+ check_part(man, n);
}
-static int
+static void
post_ft(CHKARGS)
{
char *cp;
int ok;
if (0 == n->nchild)
- return(1);
+ return;
ok = 0;
cp = n->child->string;
if (1 < n->nchild)
mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line,
n->pos, "want one child (have %d)", n->nchild);
-
- return(1);
}
-static int
+static void
check_part(CHKARGS)
{
if (MAN_BODY == n->type && 0 == n->nchild)
mandoc_msg(MANDOCERR_ARGCWARN, man->parse, n->line,
n->pos, "want children (have none)");
-
- return(1);
}
-static int
+static void
check_par(CHKARGS)
{
default:
break;
}
-
- return(1);
}
-static int
+static void
post_IP(CHKARGS)
{
default:
break;
}
- return(1);
}
-static int
+static void
post_TH(CHKARGS)
{
struct man_node *nb;
* meta-data.
*/
man_node_delete(man, man->last);
- return(1);
}
-static int
+static void
post_nf(CHKARGS)
{
n->line, n->pos, "nf");
man->flags |= MAN_LITERAL;
- return(1);
}
-static int
+static void
post_fi(CHKARGS)
{
n->line, n->pos, "fi");
man->flags &= ~MAN_LITERAL;
- return(1);
}
-static int
+static void
post_UC(CHKARGS)
{
static const char * const bsd_versions[] = {
free(man->meta.source);
man->meta.source = mandoc_strdup(p);
- return(1);
}
-static int
+static void
post_AT(CHKARGS)
{
static const char * const unix_versions[] = {
free(man->meta.source);
man->meta.source = mandoc_strdup(p);
- return(1);
}
-static int
+static void
post_vs(CHKARGS)
{
check_le1(man, n);
if (NULL != n->prev)
- return(1);
+ return;
switch (n->parent->tok) {
case MAN_SH:
default:
break;
}
-
- return(1);
}
-/* $Id: tree.c,v 1.59 2014/10/20 01:43:48 schwarze Exp $ */
+/* $Id: tree.c,v 1.60 2014/11/28 05:51:32 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
case MAN_BODY:
t = "block-body";
break;
- case MAN_TAIL:
- t = "block-tail";
- break;
case MAN_TBL:
break;
case MAN_EQN:
/* FALLTHROUGH */
case MAN_HEAD:
/* FALLTHROUGH */
- case MAN_TAIL:
- /* FALLTHROUGH */
case MAN_BODY:
p = man_macronames[n->tok];
break;