summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2013-10-05 22:08:12 +0000
committerIngo Schwarze <schwarze@openbsd.org>2013-10-05 22:08:12 +0000
commit3c869ef07e567e3ae0ecdbc5ad0d7b12c86c50cb (patch)
treef61c5d4a321554fbd04189cad9eb97ce651ac31c /mdoc_validate.c
parent953ee7904394055e28884ec864e0f9f074192fe0 (diff)
downloadmandoc-3c869ef07e567e3ae0ecdbc5ad0d7b12c86c50cb.tar.gz
Support setting arbitrary roff(7) number registers,
preserving read support for the ".nr nS" SYNOPSIS state register. Inspired by NetBSD roff.c rev. 1.18 (Christos Zoulas, March 21, 2013), but implemented differently. I don't want to have yet another different implementation of a hash table in mandoc - it would be the second one in roff.c alone and the fifth one in mandoc grand total. Instead, i designed and implemented roff_setreg() and roff_getreg() to be similar to roff_setstrn() and roff_getstrn(). Once we feel the need to optimize, we can introduce one common hash table implementation for everything in mandoc.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 64632c69..2244cc1b 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2011, 2012, 2013 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
@@ -888,8 +888,6 @@ pre_sh(PRE_ARGS)
if (MDOC_BLOCK != n->type)
return(1);
-
- roff_regunset(mdoc->roff, REG_nS);
return(check_parent(mdoc, n, MDOC_MAX, MDOC_ROOT));
}
@@ -1905,10 +1903,13 @@ post_sh_head(POST_ARGS)
/* The SYNOPSIS gets special attention in other areas. */
- if (SEC_SYNOPSIS == sec)
+ if (SEC_SYNOPSIS == sec) {
+ roff_setreg(mdoc->roff, "nS", 1);
mdoc->flags |= MDOC_SYNOPSIS;
- else
+ } else {
+ roff_setreg(mdoc->roff, "nS", 0);
mdoc->flags &= ~MDOC_SYNOPSIS;
+ }
/* Mark our last section. */