=================================================================== RCS file: /cvs/mandoc/man_macro.c,v retrieving revision 1.3 retrieving revision 1.6 diff -u -p -r1.3 -r1.6 --- mandoc/man_macro.c 2009/03/23 15:20:51 1.3 +++ mandoc/man_macro.c 2009/03/25 15:36:05 1.6 @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.3 2009/03/23 15:20:51 kristaps Exp $ */ +/* $Id: man_macro.c,v 1.6 2009/03/25 15:36:05 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -56,18 +56,50 @@ man_macro(struct man *man, int tok, int line, man->next = MAN_NEXT_SIBLING; } - /* TODO: validate. */ - /* TODO: validate. */ + for ( ; man->last && man->last != n; + man->last = man->last->parent) { + if ( ! man_valid_post(man)) + return(0); + if ( ! man_action_post(man)) + return(0); + } - man->last = n; + assert(man->last); + + if ( ! man_valid_post(man)) + return(0); + if ( ! man_action_post(man)) + return(0); + man->next = MAN_NEXT_SIBLING; return(1); } -/* ARGSUSED */ int +man_macroend(struct man *m) +{ + + for ( ; m->last && m->last != m->first; + m->last = m->last->parent) { + if ( ! man_valid_post(m)) + return(0); + if ( ! man_action_post(m)) + return(0); + } + + if ( ! man_valid_post(m)) + return(0); + if ( ! man_action_post(m)) + return(0); + + return(1); +} + + +/* ARGSUSED */ +static int man_args(struct man *man, int line, int *pos, char *buf, char **v) {