=================================================================== RCS file: /cvs/mandoc/Attic/validate.c,v retrieving revision 1.43 retrieving revision 1.45 diff -u -p -r1.43 -r1.45 --- mandoc/Attic/validate.c 2009/01/20 12:51:28 1.43 +++ mandoc/Attic/validate.c 2009/01/20 20:56:21 1.45 @@ -1,4 +1,4 @@ -/* $Id: validate.c,v 1.43 2009/01/20 12:51:28 kristaps Exp $ */ +/* $Id: validate.c,v 1.45 2009/01/20 20:56:21 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -21,6 +21,14 @@ #include "private.h" +/* + * Pre- and post-validate macros as they're parsed. Pre-validation + * occurs when the macro has been detected and its arguments parsed. + * Post-validation occurs when all child macros have also been parsed. + * In the ELEMENT case, this is simply the parameters of the macro; in + * the BLOCK case, this is the HEAD, BODY, TAIL and so on. + */ + typedef int (*v_pre)(struct mdoc *, struct mdoc_node *); typedef int (*v_post)(struct mdoc *); @@ -129,6 +137,9 @@ static v_post posts_at[] = { post_at, NULL }; static v_post posts_xr[] = { eerr_ge1, eerr_le2, post_xr, NULL }; static v_post posts_nm[] = { post_nm, NULL }; static v_post posts_bf[] = { herr_le1, post_bf, NULL }; +static v_post posts_rs[] = { herr_eq0, bwarn_ge1, NULL }; +static v_post posts_fo[] = { bwarn_ge1, NULL }; +static v_post posts_bk[] = { herr_eq0, bwarn_ge1, NULL }; /* Per-macro pre- and post-child-check routine collections. */ @@ -220,7 +231,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL }, /* Qo */ { NULL, posts_wline }, /* Qq */ { NULL, NULL }, /* Re */ - { NULL, NULL }, /* Rs */ + { NULL, posts_rs }, /* Rs */ { NULL, NULL }, /* Sc */ { NULL, NULL }, /* So */ { NULL, posts_wline }, /* Sq */ @@ -231,11 +242,11 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL }, /* Ux */ { NULL, NULL }, /* Xc */ { NULL, NULL }, /* Xo */ - { NULL, NULL }, /* Fo */ + { NULL, posts_fo }, /* Fo */ { NULL, NULL }, /* Fc */ { NULL, NULL }, /* Oo */ { NULL, NULL }, /* Oc */ - { NULL, NULL }, /* Bk */ + { NULL, posts_bk }, /* Bk */ { NULL, NULL }, /* Ek */ { NULL, posts_notext }, /* Bt */ { NULL, NULL }, /* Hf */