aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.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
commita572afd89f35bf2a05cba26f422436714a0de4de (patch)
treed357d349c277f8b918065cab513078e2e229d0a6 /mdoc.c
parenta8f58a55c9e1fd8a3804c52ca3873c8291135319 (diff)
downloadmandoc-a572afd89f35bf2a05cba26f422436714a0de4de.tar.gz
mandoc-a572afd89f35bf2a05cba26f422436714a0de4de.tar.zst
mandoc-a572afd89f35bf2a05cba26f422436714a0de4de.zip
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.c')
-rw-r--r--mdoc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/mdoc.c b/mdoc.c
index df68229c..c5cfef3c 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.203 2012/11/17 00:26:33 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.204 2013/10/05 22:08:12 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -295,12 +295,10 @@ mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs)
* whether this mode is on or off.
* Note that this mode is also switched by the Sh macro.
*/
- if (roff_regisset(mdoc->roff, REG_nS)) {
- if (roff_regget(mdoc->roff, REG_nS))
- mdoc->flags |= MDOC_SYNOPSIS;
- else
- mdoc->flags &= ~MDOC_SYNOPSIS;
- }
+ if (roff_getreg(mdoc->roff, "nS"))
+ mdoc->flags |= MDOC_SYNOPSIS;
+ else
+ mdoc->flags &= ~MDOC_SYNOPSIS;
return(roff_getcontrol(mdoc->roff, buf, &offs) ?
mdoc_pmacro(mdoc, ln, buf, offs) :