/contrib/groff/tmac/doc.tmac

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 6528 lines · 6528 code · 0 blank · 0 comment · 0 complexity · 6c11476a85141ace1a38d6cedbd96c22 MD5 · raw file

Large files are truncated click here to view the full file

  1. .\" Copyright (c) 1991, 1993
  2. .\" The Regents of the University of California. All rights reserved.
  3. .\"
  4. .\" Redistribution and use in source and binary forms, with or without
  5. .\" modification, are permitted provided that the following conditions
  6. .\" are met:
  7. .\" 1. Redistributions of source code must retain the above copyright
  8. .\" notice, this list of conditions and the following disclaimer.
  9. .\" 2. Redistributions in binary form must reproduce the above copyright
  10. .\" notice, this list of conditions and the following disclaimer in the
  11. .\" documentation and/or other materials provided with the distribution.
  12. .\" 3. [Deleted. See
  13. .\" ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change]
  14. .\" 4. Neither the name of the University nor the names of its contributors
  15. .\" may be used to endorse or promote products derived from this software
  16. .\" without specific prior written permission.
  17. .\"
  18. .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  19. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. .\" SUCH DAMAGE.
  29. .\"
  30. .\" @(#)doc 8.1 (Berkeley) 06/08/93
  31. .\"
  32. .\" Modified by jjc@jclark.com as follows: the doc-* files are assumed to be
  33. .\" installed as mdoc/doc-* rather than tmac.doc-* (the filename
  34. .\" `tmac.doc-common' would be too long); when using groff, the doc-* files
  35. .\" are loaded using the `mso' request.
  36. .\"
  37. .\" Modified by
  38. .\"
  39. .\" Werner LEMBERG <wl@gnu.org> and
  40. .\" Ruslan Ermilov <ru@freebsd.org>
  41. .\"
  42. .\" to make it more readable: using long names and many groff features,
  43. .\" updating and extending documentation, etc.
  44. .\"
  45. .\" %beginstrip%
  46. .
  47. .
  48. .if !\n(.g \
  49. . ab This version of mdoc can be run with GNU troff only!
  50. .
  51. .
  52. .do if d Dd .nx
  53. .
  54. .
  55. .cp 0
  56. .
  57. .
  58. .if (\n[.x]\n[.y] < 118) \
  59. . ab You need GNU troff version 1.18 or higher to run this version of mdoc!
  60. .
  61. .
  62. .\" Load start-up files
  63. .ie t \
  64. . mso mdoc/doc-ditroff
  65. .el \
  66. . mso mdoc/doc-nroff
  67. .
  68. .mso mdoc/doc-common
  69. .mso mdoc/doc-syms
  70. .
  71. .
  72. .eo
  73. .
  74. .
  75. .\" NS doc-macro-name global string
  76. .\" NS name of calling request (set in each user-requestable macro)
  77. .
  78. .ds doc-macro-name
  79. .als doc-arg0 doc-macro-name
  80. .
  81. .
  82. .\" NS doc-arg-limit global register
  83. .\" NS total number of arguments
  84. .
  85. .nr doc-arg-limit 0
  86. .
  87. .
  88. .\" NS doc-num-args global register
  89. .\" NS number of arguments to handle (must be set to \n[.$] prior to
  90. .\" NS `doc-parse-arg-vector' request)
  91. .
  92. .nr doc-num-args 0
  93. .
  94. .
  95. .\" NS doc-arg-ptr global register
  96. .\" NS argument pointer
  97. .
  98. .nr doc-arg-ptr 0
  99. .
  100. .
  101. .\" NS doc-argXXX global string
  102. .\" NS argument vector
  103. .\" NS
  104. .\" NS limit:
  105. .\" NS doc-arg-limit
  106. .
  107. .ds doc-arg1
  108. .
  109. .
  110. .\" NS doc-typeXXX global register
  111. .\" NS argument type vector (macro=1, string=2, punctuation suffix=3,
  112. .\" NS punctuation prefix=4)
  113. .\" NS
  114. .\" NS limit:
  115. .\" NS doc-arg-limit
  116. .
  117. .nr doc-type1 0
  118. .
  119. .
  120. .\" NS doc-spaceXXX global string
  121. .\" NS space vector
  122. .\" NS
  123. .\" NS limit:
  124. .\" NS doc-arg-limit
  125. .
  126. .ds doc-space1
  127. .
  128. .
  129. .\" NS doc-parse-args macro
  130. .\" NS parse arguments (recursively) (`.doc-parse-args arg ...')
  131. .\" NS
  132. .\" NS modifies:
  133. .\" NS doc-arg-limit
  134. .\" NS doc-arg-ptr
  135. .\" NS doc-argXXX
  136. .\" NS doc-spaceXXX
  137. .\" NS doc-typeXXX
  138. .\" NS doc-arg-ptr
  139. .\" NS doc-have-space
  140. .\" NS
  141. .\" NS local variables:
  142. .\" NS doc-reg-dpa
  143. .\" NS doc-reg-dpa1
  144. .\" NS doc-str-dpa
  145. .
  146. .de doc-parse-args
  147. . if !\n[doc-arg-limit] \
  148. . doc-set-spacing-1
  149. .
  150. . nr doc-have-space 0
  151. .
  152. . if !\n[.$] \
  153. . return
  154. .
  155. . nr doc-arg-limit +1
  156. .
  157. . \" handle `|' and `...' specially
  158. . ie "\$1"|" \
  159. . ds doc-arg\n[doc-arg-limit] \f[R]|\f[]
  160. . el \{ .ie "\$1"..." \
  161. . ds doc-arg\n[doc-arg-limit] \|.\|.\|.
  162. . el \
  163. . ds doc-arg\n[doc-arg-limit] "\$1
  164. . \}
  165. .
  166. . \" get argument type and set spacing
  167. . doc-get-arg-type* \n[doc-arg-limit]
  168. . nr doc-type\n[doc-arg-limit] \n[doc-arg-type]
  169. . doc-set-spacing-\n[doc-arg-type]
  170. .
  171. . \" check whether we have processed the last parameter
  172. . ie (\n[.$] == 1) \
  173. . nr doc-arg-ptr 0
  174. . el \{\
  175. . shift
  176. . doc-parse-args \$@
  177. . \}
  178. .
  179. . nh
  180. ..
  181. .
  182. .
  183. .\" NS doc-parse-arg-vector macro
  184. .\" NS parse argument vector (recursive)
  185. .\" NS
  186. .\" NS cf. comments in doc-parse-args
  187. .\" NS
  188. .\" NS modifies:
  189. .\" NS doc-arg-limit
  190. .\" NS doc-arg-ptr
  191. .\" NS doc-argXXX
  192. .\" NS doc-num-args
  193. .\" NS doc-spaceXXX
  194. .\" NS doc-typeXXX
  195. .\" NS
  196. .\" NS local variables:
  197. .\" NS doc-reg-dpav
  198. .\" NS doc-reg-dpav1
  199. .\" NS doc-str-dpav
  200. .
  201. .de doc-parse-arg-vector
  202. . if !\n[doc-arg-limit] \
  203. . doc-set-spacing-1
  204. .
  205. . nr doc-arg-limit +1
  206. .
  207. . ie "\*[doc-arg\n[doc-arg-limit]]"|" \
  208. . ds doc-arg\n[doc-arg-limit] \f[R]|\f[]
  209. . el \{ .if "\*[doc-arg\n[doc-arg-limit]]"..." \
  210. . ds doc-arg\n[doc-arg-limit] \|.\|.\|.
  211. . \}
  212. .
  213. . doc-get-arg-type* \n[doc-arg-limit]
  214. . nr doc-type\n[doc-arg-limit] \n[doc-arg-type]
  215. . doc-set-spacing-\n[doc-arg-type]
  216. .
  217. . ie (\n[doc-num-args] == 1) \{\
  218. . nr doc-arg-ptr 0
  219. . nr doc-num-args 0
  220. . \}
  221. . el \{\
  222. . nr doc-num-args -1
  223. . doc-parse-arg-vector
  224. . \}
  225. .
  226. . nh
  227. ..
  228. .
  229. .
  230. .\" NS doc-parse-space-vector macro
  231. .\" NS parse space vector (recursive)
  232. .\" NS
  233. .\" NS modifies:
  234. .\" NS doc-arg-limit
  235. .\" NS doc-num-args
  236. .\" NS doc-spaceXXX
  237. .
  238. .de doc-parse-space-vector
  239. . nr doc-arg-limit +1
  240. .
  241. . doc-set-spacing-\n[doc-type\n[doc-arg-limit]]
  242. .
  243. . ie (\n[doc-num-args] == 1) \
  244. . nr doc-num-args 0
  245. . el \{\
  246. . nr doc-num-args -1
  247. . doc-parse-space-vector
  248. . \}
  249. ..
  250. .
  251. .
  252. .\" NS doc-remaining-args macro
  253. .\" NS output remaining arguments as-is, separated by spaces (until
  254. .\" NS `doc-num-args' is exhausted)
  255. .\" NS
  256. .\" NS modifies:
  257. .\" NS doc-arg-ptr
  258. .\" NS doc-num-args
  259. .
  260. .de doc-remaining-args
  261. . nr doc-arg-ptr +1
  262. . nop \)\*[doc-arg\n[doc-arg-ptr]]\c
  263. .
  264. . ie (\n[doc-num-args] == 1) \{\
  265. . nr doc-arg-ptr 0
  266. . nr doc-num-args 0
  267. . \}
  268. . el \{\
  269. . nop \)\*[doc-space]\c
  270. . nr doc-num-args -1
  271. . doc-remaining-args
  272. . \}
  273. ..
  274. .
  275. .
  276. .\" NS doc-append-arg macro
  277. .\" NS append one argument to argument vector:
  278. .\" NS `.doc-append-arg [arg] [type]'
  279. .\" NS
  280. .\" NS modifies:
  281. .\" NS doc-arg-limit
  282. .\" NS doc-argXXX
  283. .\" NS doc-typeXXX
  284. .
  285. .de doc-append-arg
  286. . nr doc-arg-limit +1
  287. . ds doc-arg\n[doc-arg-limit] "\$1
  288. . nr doc-type\n[doc-arg-limit] \$2
  289. . doc-set-spacing-\$2
  290. ..
  291. .
  292. .
  293. .\" NS doc-print-and-reset macro
  294. .\" NS finish input line and clean up argument vectors
  295. .
  296. .de doc-print-and-reset
  297. . if \n[doc-space-mode] \
  298. . nop \)
  299. . doc-reset-args
  300. ..
  301. .
  302. .
  303. .\" NS doc-reset-args macro
  304. .\" NS reset argument counters
  305. .\" NS
  306. .\" NS modifies:
  307. .\" NS doc-arg-limit
  308. .\" NS doc-arg-ptr
  309. .\" NS doc-have-slot
  310. .
  311. .de doc-reset-args
  312. . nr doc-arg-limit 0
  313. . nr doc-arg-ptr 0
  314. . nr doc-have-slot 0
  315. .
  316. . hy \n[doc-hyphen-flags]
  317. ..
  318. .
  319. .
  320. .ec
  321. .
  322. .\" NS doc-curr-font global register
  323. .\" NS saved current font
  324. .
  325. .nr doc-curr-font \n[.f]
  326. .
  327. .
  328. .\" NS doc-curr-size global register
  329. .\" NS saved current font size
  330. .
  331. .nr doc-curr-size \n[.ps]
  332. .
  333. .eo
  334. .
  335. .
  336. .\" NS Fl user macro
  337. .\" NS handle flags (appends `-' and prints flags): `.Fl [arg ...]'
  338. .\" NS
  339. .\" NS modifies:
  340. .\" NS doc-arg-ptr
  341. .\" NS doc-curr-font
  342. .\" NS doc-curr-size
  343. .\" NS doc-macro-name
  344. .\" NS
  345. .\" NS local variables:
  346. .\" NS doc-reg-Fl (for communication with doc-flag-recursion)
  347. .\" NS
  348. .\" NS width register `Fl' set in doc-common
  349. .
  350. .de Fl
  351. . nr doc-curr-font \n[.f]
  352. . nr doc-curr-size \n[.ps]
  353. . nop \*[doc-Fl-font]\c
  354. .
  355. . if !\n[doc-arg-limit] \{\
  356. . ds doc-macro-name Fl
  357. . doc-parse-args \$@
  358. .
  359. . \" no arguments
  360. . if !\n[.$] \
  361. . nop \|\-\|\f[]\s[0]
  362. . \}
  363. .
  364. . if !\n[doc-arg-limit] \
  365. . return
  366. .
  367. . nr doc-arg-ptr +1
  368. . ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
  369. . \" last argument
  370. . nop \|\-\f[]\s[0]\c
  371. . doc-print-and-reset
  372. . \}
  373. . el \{\
  374. . ie (\n[doc-type\n[doc-arg-ptr]] == 1) \{\
  375. . nop \|\-\f[]\s[0]\c
  376. . \*[doc-arg\n[doc-arg-ptr]]
  377. . \}
  378. . el \{\
  379. . if (\n[doc-type\n[doc-arg-ptr]] == 3) \
  380. . nop \|\-\|\c
  381. .
  382. . nr doc-reg-Fl 1
  383. . doc-flag-recursion
  384. . \}\}
  385. ..
  386. .
  387. .
  388. .\" NS doc-flag-recursion macro
  389. .\" NS `Fl' flag recursion routine (special handling)
  390. .\" NS
  391. .\" NS modifies:
  392. .\" NS doc-arg-ptr
  393. .\" NS
  394. .\" NS local variables:
  395. .\" NS doc-reg-dfr
  396. .\" NS doc-reg-dfr1
  397. .\" NS doc-str-dfr
  398. .
  399. .de doc-flag-recursion
  400. . nr doc-reg-dfr1 \n[doc-type\n[doc-arg-ptr]]
  401. . ds doc-str-dfr "\*[doc-arg\n[doc-arg-ptr]]
  402. .
  403. . ie (\n[doc-reg-dfr1] == 1) \{\
  404. . nop \f[]\s[0]\c
  405. . \*[doc-str-dfr]
  406. . \}
  407. . el \{\
  408. . nr doc-reg-dfr \n[doc-arg-ptr]
  409. .
  410. . ie (\n[doc-reg-dfr1] == 2) \{\
  411. . \" handle vertical bar -- doc-reg-Fl is set for the first call of
  412. . \" doc-flag-recursion only; we need this to make `.Fl | ...' work
  413. . \" correctly
  414. . ie "\*[doc-str-dfr]"\*[Ba]" \{\
  415. . if \n[doc-reg-Fl] \
  416. . nop \|\-\*[doc-space]\c
  417. . nop \)\*[Ba]\c
  418. . \}
  419. . el \{\
  420. . ie "\*[doc-str-dfr]"\f[R]|\f[]" \{\
  421. . if \n[doc-reg-Fl] \
  422. . nop \|\-\*[doc-space]\c
  423. . nop \f[R]|\f[]\c
  424. . \}
  425. . el \{\
  426. . \" two consecutive hyphen characters?
  427. . ie "\*[doc-str-dfr]"-" \
  428. . nop \|\-\^\-\|\c
  429. . el \
  430. . nop \|\%\-\*[doc-str-dfr]\&\c
  431. . \}\}\}
  432. . el \{\
  433. . nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
  434. . nop \)\*[doc-str-dfr]\f[]\s[0]\c
  435. . \}
  436. .
  437. . ie (\n[doc-arg-limit] == \n[doc-arg-ptr]) \{\
  438. . \" last argument
  439. . if (\n[doc-reg-dfr1] == 4) \
  440. . nop \|\-\c
  441. . nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
  442. . doc-print-and-reset
  443. . \}
  444. . el \{\
  445. . nr doc-arg-ptr +1
  446. . ie (\n[doc-type\n[doc-arg-ptr]] == 3) \{\
  447. . ie (\n[doc-type\n[doc-reg-dfr]] == 4) \
  448. . nop \|\-\c
  449. . el \
  450. . nop \)\*[doc-space\n[doc-reg-dfr]]\c
  451. . \}
  452. . el \
  453. . nop \)\*[doc-space\n[doc-reg-dfr]]\c
  454. .
  455. . shift
  456. . nr doc-reg-Fl 0
  457. . doc-flag-recursion \$@
  458. . \}\}
  459. ..
  460. .
  461. .
  462. .\" NS doc-print-recursive macro
  463. .\" NS general name recursion routine (print remaining arguments)
  464. .\" NS
  465. .\" NS modifies:
  466. .\" NS doc-arg-ptr
  467. .\" NS
  468. .\" NS local variables:
  469. .\" NS doc-reg-dpr
  470. .\" NS doc-reg-dpr1
  471. .\" NS doc-str-dpr
  472. .
  473. .de doc-print-recursive
  474. . nr doc-reg-dpr1 \n[doc-type\n[doc-arg-ptr]]
  475. . ds doc-str-dpr "\*[doc-arg\n[doc-arg-ptr]]
  476. .
  477. . ie (\n[doc-reg-dpr1] == 1) \{\
  478. . nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
  479. . \*[doc-str-dpr]
  480. . \}
  481. . el \{\
  482. . nr doc-reg-dpr \n[doc-arg-ptr]
  483. .
  484. . \" the `\%' prevents hyphenation on a dash (`-')
  485. . ie (\n[doc-reg-dpr1] == 2) \
  486. . nop \%\*[doc-str-dpr]\&\c
  487. . el \{\
  488. . \" punctuation character
  489. . nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
  490. . nop \)\*[doc-str-dpr]\f[]\s[0]\c
  491. . \}
  492. .
  493. . nr doc-arg-ptr +1
  494. . ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
  495. . \" last argument
  496. . nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
  497. . doc-print-and-reset
  498. . \}
  499. . el \{\
  500. . nop \)\*[doc-space\n[doc-reg-dpr]]\c
  501. . doc-print-recursive
  502. . \}\}
  503. ..
  504. .
  505. .
  506. .\" NS doc-print-prefixes macro
  507. .\" NS print leading prefixes
  508. .\" NS
  509. .\" NS modifies:
  510. .\" NS doc-arg-ptr
  511. .
  512. .de doc-print-prefixes
  513. . while (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
  514. . if !(\n[doc-type\n[doc-arg-ptr]] == 4) \
  515. . break
  516. . nop \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]\c
  517. . nop \)\*[doc-arg\n[doc-arg-ptr]]\f[]\s[0]\c
  518. . nr doc-arg-ptr +1
  519. . \}
  520. ..
  521. .
  522. .
  523. .\" NS doc-generic-macro macro
  524. .\" NS this is the skeleton for most simple macros
  525. .\" NS
  526. .\" NS modifies:
  527. .\" NS doc-arg-ptr
  528. .\" NS doc-curr-font
  529. .\" NS doc-curr-size
  530. .\" NS doc-macro-name
  531. .
  532. .de doc-generic-macro
  533. . if !\n[doc-arg-limit] \{\
  534. . ie \n[.$] \{\
  535. . ds doc-macro-name \$0
  536. . doc-parse-args \$@
  537. . \}
  538. . el \
  539. . tm Usage: .\$0 \*[doc-\$0-usage] ... (#\n[.c])
  540. . \}
  541. .
  542. . if !\n[doc-arg-limit] \
  543. . return
  544. .
  545. . nr doc-arg-ptr +1
  546. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
  547. . if (\n[doc-type\n[doc-arg-ptr]] == 1) \{\
  548. . tmc mdoc warning: Using a macro as first argument
  549. . tm1 " cancels effect of .\$0 (#\n[.c])
  550. .
  551. . \" the right action here would be to reset the argument counters
  552. . \" and bail out -- unfortunately, a small number of manual pages
  553. . \" (less than 2% for FreeBSD which has been used for testing)
  554. . \" relied on the old behaviour (silently ignore this error),
  555. . \" so it is commented out
  556. .
  557. .\" doc-reset-args
  558. . \}
  559. .\" el \{\
  560. . nr doc-curr-font \n[.f]
  561. . nr doc-curr-size \n[.ps]
  562. . nop \*[doc-\$0-font]\c
  563. . doc-print-recursive
  564. .\" \}
  565. . \}
  566. . el \{\
  567. . tm Usage: .\$0 \*[doc-\$0-usage] ... (#\n[.c])
  568. . doc-reset-args
  569. . \}
  570. ..
  571. .
  572. .
  573. .\" NS Ar user macro
  574. .\" NS command line `argument' macro: `.Ar [args ...]'
  575. .\" NS
  576. .\" NS modifies:
  577. .\" NS doc-arg-ptr
  578. .\" NS doc-curr-font
  579. .\" NS doc-curr-size
  580. .\" NS doc-macro-name
  581. .\" NS
  582. .\" NS local variable:
  583. .\" NS doc-str-Ar-default
  584. .\" NS
  585. .\" NS width register `Ar' set in doc-common
  586. .
  587. .ds doc-str-Ar-default "file\ .\|.\|.
  588. .
  589. .de Ar
  590. . nr doc-curr-font \n[.f]
  591. . nr doc-curr-size \n[.ps]
  592. . nop \*[doc-Ar-font]\c
  593. .
  594. . if !\n[doc-arg-limit] \{\
  595. . ds doc-macro-name Ar
  596. . doc-parse-args \$@
  597. .
  598. . \" no argument
  599. . if !\n[.$] \
  600. . nop \)\*[doc-str-Ar-default]\&\f[]\s[0]
  601. . \}
  602. .
  603. . if !\n[doc-arg-limit] \
  604. . return
  605. .
  606. . nr doc-arg-ptr +1
  607. . doc-print-prefixes
  608. . ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
  609. . nop \)\*[doc-str-Ar-default]\&\f[]\s[0]\c
  610. . doc-print-and-reset
  611. . \}
  612. . el \{\
  613. . if !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
  614. . \" replace previous argument (Ar) with default value
  615. . nr doc-arg-ptr -1
  616. . ds doc-arg\n[doc-arg-ptr] "\*[doc-str-Ar-default]
  617. . nr doc-type\n[doc-arg-ptr] 2
  618. . ds doc-space\n[doc-arg-ptr] "\*[doc-space]
  619. .
  620. . \" recompute space vector for remaining arguments
  621. . nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr])
  622. . nr doc-arg-limit \n[doc-arg-ptr]
  623. . doc-parse-space-vector
  624. . \}
  625. . doc-print-recursive
  626. . \}
  627. ..
  628. .
  629. .
  630. .\" NS Ad user macro
  631. .\" NS Addresses
  632. .\" NS
  633. .\" NS width register `Ad' set in doc-common
  634. .
  635. .als Ad doc-generic-macro
  636. .ds doc-Ad-usage address
  637. .
  638. .
  639. .\" NS doc-indent-synopsis global register
  640. .\" NS indentation in synopsis
  641. .
  642. .nr doc-indent-synopsis 0
  643. .
  644. .
  645. .\" NS doc-indent-synopsis-active global register (bool)
  646. .\" NS indentation in synopsis active
  647. .
  648. .nr doc-indent-synopsis-active 0
  649. .
  650. .
  651. .\" NS Cd user macro
  652. .\" NS config declaration (for section 4 SYNOPSIS)
  653. .\" NS
  654. .\" NS this function causes a break; it uses the `Nm' font
  655. .\" NS
  656. .\" NS modifies:
  657. .\" NS doc-arg-ptr
  658. .\" NS doc-curr-font
  659. .\" NS doc-curr-size
  660. .\" NS doc-indent-synopsis
  661. .\" NS doc-macro-name
  662. .\" NS
  663. .\" NS width register `Cd' set in doc-common
  664. .
  665. .de Cd
  666. . if !\n[doc-arg-limit] \{\
  667. . ie \n[.$] \{\
  668. . ds doc-macro-name Cd
  669. . doc-parse-args \$@
  670. . \}
  671. . el \
  672. . tm Usage: .Cd configuration_file_declaration ... (#\n[.c])
  673. . \}
  674. .
  675. . if !\n[doc-arg-limit] \
  676. . return
  677. .
  678. . nr doc-arg-ptr +1
  679. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
  680. . nr doc-curr-font \n[.f]
  681. . nr doc-curr-size \n[.ps]
  682. .
  683. . ie \n[doc-in-synopsis-section] \{\
  684. . ie "\*[doc-macro-name]"Cd" \{\
  685. . br
  686. . if !\n[doc-indent-synopsis] \
  687. . nr doc-indent-synopsis \n[doc-display-indent]u
  688. . if !\n[doc-indent-synopsis-active] \
  689. . in +\n[doc-indent-synopsis]u
  690. . ti -\n[doc-indent-synopsis]u
  691. . nop \*[doc-Nm-font]\c
  692. . doc-print-recursive
  693. . if !\n[doc-indent-synopsis-active] \
  694. . in -\n[doc-indent-synopsis]u
  695. . \}
  696. . el \{\
  697. . nop \*[doc-Nm-font]\c
  698. . doc-print-recursive
  699. . \}\}
  700. . el \{\
  701. . nop \*[doc-Nm-font]\c
  702. . doc-print-recursive
  703. . \}\}
  704. . el \{\
  705. . tm Usage: .Cd configuration_file_declaration ... (#\n[.c])
  706. . doc-reset-args
  707. . \}
  708. ..
  709. .
  710. .
  711. .\" NS Cm user macro
  712. .\" NS interactive command modifier (flag)
  713. .\" NS
  714. .\" NS width register `Cm' set in doc-common
  715. .
  716. .als Cm doc-generic-macro
  717. .ds doc-Cm-usage interactive_command_modifier
  718. .
  719. .
  720. .\" NS Dv user macro
  721. .\" NS defined variable
  722. .\" NS
  723. .\" NS this function uses the `Er' font
  724. .\" NS
  725. .\" NS width register `Dv' set in doc-common
  726. .
  727. .als Dv doc-generic-macro
  728. .ds doc-Dv-usage defined_variable
  729. .als doc-Dv-font doc-Er-font
  730. .
  731. .
  732. .\" NS Em user macro
  733. .\" NS emphasis
  734. .\" NS
  735. .\" NS width register `Em' set in doc-common
  736. .
  737. .als Em doc-generic-macro
  738. .ds doc-Em-usage text
  739. .
  740. .
  741. .\" NS Er user macro
  742. .\" NS errno type
  743. .\" NS
  744. .\" NS width register `Er' set in doc-common
  745. .
  746. .als Er doc-generic-macro
  747. .ds doc-Er-usage text
  748. .
  749. .
  750. .\" NS Ev user macro
  751. .\" NS environment variable
  752. .\" NS
  753. .\" NS width register `Ev' set in doc-common
  754. .
  755. .als Ev doc-generic-macro
  756. .ds doc-Ev-usage text
  757. .
  758. .
  759. .\" NS doc-have-decl global register (bool)
  760. .\" NS subroutine test (in synopsis only)
  761. .
  762. .nr doc-have-decl 0
  763. .
  764. .
  765. .\" NS doc-have-var global register (bool)
  766. .\" NS whether last type is a variable type
  767. .
  768. .nr doc-have-var 0
  769. .
  770. .
  771. .\" NS doc-do-func-decl macro
  772. .\" NS do something special while in SYNOPSIS
  773. .\" NS
  774. .\" NS modifies:
  775. .\" NS doc-curr-font
  776. .\" NS doc-curr-size
  777. .\" NS doc-have-decl
  778. .\" NS doc-have-var
  779. .
  780. .de doc-do-func-decl
  781. . if \n[doc-in-synopsis-section] \{\
  782. . \" if a variable type was the last thing given, want vertical space
  783. . if \n[doc-have-var] \{\
  784. . doc-paragraph
  785. . nr doc-have-var 0
  786. . \}
  787. . \" if a subroutine was the last thing given, want vertical space
  788. . if \n[doc-have-func] \{\
  789. . ie \n[doc-have-decl] \
  790. . br
  791. . el \
  792. . doc-paragraph
  793. . \}
  794. . nr doc-have-decl 1
  795. . \}
  796. .
  797. . nr doc-curr-font \n[.f]
  798. . nr doc-curr-size \n[.ps]
  799. ..
  800. .
  801. .
  802. .\" NS Fd user macro
  803. .\" NS function declaration -- not callable
  804. .\" NS
  805. .\" NS this function causes a break
  806. .\" NS
  807. .\" NS width register `Fd' set in doc-common
  808. .
  809. .de Fd
  810. . ie ((\n[.$] >= 1) & (\n[doc-arg-limit] == 0)) \{\
  811. . doc-do-func-decl
  812. . nop \*[doc-Fd-font]\$*
  813. . br
  814. . ft \n[doc-curr-font]
  815. . ps \n[doc-curr-size]u
  816. . \}
  817. . el \{\
  818. . tm Usage: .Fd function_declaration -- Fd is not callable (#\n[.c])
  819. . doc-reset-args
  820. . \}
  821. ..
  822. .
  823. .
  824. .\" NS In user macro
  825. .\" NS #include statement in SYNOPSIS
  826. .\" NS <header.h> if not in SYNOPSIS
  827. .\" NS
  828. .\" NS this function causes a break; it uses the `Fd' font
  829. .\" NS
  830. .\" NS modifies:
  831. .\" NS doc-arg-ptr
  832. .\" NS doc-curr-font
  833. .\" NS doc-curr-size
  834. .\" NS doc-indent-synopsis
  835. .\" NS doc-macro-name
  836. .\" NS
  837. .\" NS width register `In' set in doc-common
  838. .
  839. .de In
  840. . if !\n[doc-arg-limit] \{\
  841. . ie \n[.$] \{\
  842. . ds doc-macro-name In
  843. . doc-parse-args \$@
  844. . \}
  845. . el \
  846. . tm Usage: .In include_file ... (#\n[.c])
  847. . \}
  848. .
  849. . if !\n[doc-arg-limit] \
  850. . return
  851. .
  852. . nr doc-arg-ptr +1
  853. . doc-print-prefixes
  854. . ie ((\n[doc-arg-limit] >= \n[doc-arg-ptr]) & (\n[doc-type\n[doc-arg-ptr]] == 2)) \{\
  855. . nr doc-curr-font \n[.f]
  856. . nr doc-curr-size \n[.ps]
  857. .
  858. . ie \n[doc-in-synopsis-section] \{\
  859. . ie "\*[doc-macro-name]"In" \{\
  860. . doc-do-func-decl
  861. . nop \*[doc-Fd-font]#include <\*[doc-arg\n[doc-arg-ptr]]>
  862. . ft \n[doc-curr-font]
  863. . ps \n[doc-curr-size]u
  864. . br
  865. . nr doc-arg-ptr +1
  866. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
  867. . doc-print-recursive
  868. . el \
  869. . doc-reset-args
  870. . \}
  871. . el \{\
  872. . ds doc-arg\n[doc-arg-ptr] "<\*[doc-Pa-font]\*[doc-arg\n[doc-arg-ptr]]
  873. . as doc-arg\n[doc-arg-ptr] \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]>
  874. . doc-print-recursive
  875. . \}\}
  876. . el \{\
  877. . ds doc-arg\n[doc-arg-ptr] "<\*[doc-Pa-font]\*[doc-arg\n[doc-arg-ptr]]
  878. . as doc-arg\n[doc-arg-ptr] \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u]>
  879. . doc-print-recursive
  880. . \}\}
  881. . el \{\
  882. . tm Usage: .In include_file ... (#\n[.c])
  883. . doc-reset-args
  884. . \}
  885. ..
  886. .
  887. .
  888. .\" NS Fr user macro
  889. .\" NS function return value
  890. .\" NS
  891. .\" NS this function uses the `Ar' font
  892. .\" NS
  893. .\" NS width register `Fr' set in doc-common
  894. .
  895. .als Fr doc-generic-macro
  896. .ds doc-Fr-usage function_return_value
  897. .als doc-Fr-font doc-Ar-font
  898. .
  899. .
  900. .\" NS Ic user macro
  901. .\" NS interactive command
  902. .\" NS
  903. .\" NS width register `Ic' set in doc-common
  904. .
  905. .als Ic doc-generic-macro
  906. .ds doc-Ic-usage interactive_command
  907. .
  908. .
  909. .\" NS Li user macro
  910. .\" NS literals
  911. .\" NS
  912. .\" NS width register `Li' set in doc-common
  913. .
  914. .als Li doc-generic-macro
  915. .ds doc-Li-usage argument
  916. .
  917. .
  918. .\" NS Ms user macro
  919. .\" NS math symbol
  920. .\" NS
  921. .\" NS this function uses the `Sy' font
  922. .\" NS
  923. .\" NS width register `Ms' set in doc-common
  924. .
  925. .als Ms doc-generic-macro
  926. .ds doc-Ms-usage math_symbol
  927. .als doc-Ms-font doc-Sy-font
  928. .
  929. .
  930. .\" NS doc-command-name global string
  931. .\" NS save first invocation of .Nm
  932. .
  933. .ds doc-command-name
  934. .
  935. .
  936. .\" NS Nm user macro
  937. .\" NS name of command or page topic
  938. .\" NS
  939. .\" NS modifies:
  940. .\" NS doc-arg-ptr
  941. .\" NS doc-command-name
  942. .\" NS doc-curr-font
  943. .\" NS doc-curr-size
  944. .\" NS doc-indent-synopsis
  945. .\" NS doc-indent-synopsis-active
  946. .\" NS doc-macro-name
  947. .\" NS
  948. .\" NS width register `Nm' set in doc-common
  949. .
  950. .de Nm
  951. . if !\n[doc-arg-limit] \{\
  952. . ds doc-macro-name Nm
  953. . ie \n[.$] \
  954. . doc-parse-args \$@
  955. . el \{\
  956. . ie "\*[doc-command-name]"" \
  957. . tm Usage: .Nm name ... (#\n[.c])
  958. . el \
  959. . doc-parse-args \*[doc-command-name]
  960. . \}\}
  961. .
  962. . if !\n[doc-arg-limit] \
  963. . return
  964. .
  965. . nr doc-arg-ptr +1
  966. . doc-print-prefixes
  967. . ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
  968. . \" last argument
  969. . ie "\*[doc-command-name]"" \{\
  970. . tm Usage: .Nm name ... (#\n[.c])
  971. . doc-reset-args
  972. . \}
  973. . el \{\
  974. . nop \*[doc-Nm-font]\*[doc-command-name]\f[]\s[0]\c
  975. . doc-print-and-reset
  976. . \}\}
  977. . el \{\
  978. . nr doc-curr-font \n[.f]
  979. . nr doc-curr-size \n[.ps]
  980. .
  981. . ie !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
  982. . ie "\*[doc-command-name]"" \
  983. . tm Usage: .Nm name ... (#\n[.c])
  984. . el \{\
  985. . \" replace previous argument (Nm) with default value
  986. . nr doc-arg-ptr -1
  987. . ds doc-arg\n[doc-arg-ptr] "\*[doc-Nm-font]\*[doc-command-name]\f[]\s[0]
  988. . nr doc-type\n[doc-arg-ptr] 2
  989. . ds doc-space\n[doc-arg-ptr] "\*[doc-space]
  990. .
  991. . \" recompute space vector for remaining arguments
  992. . nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr])
  993. . nr doc-arg-limit \n[doc-arg-ptr]
  994. . doc-parse-space-vector
  995. . \}\}
  996. . el \{\
  997. . \" handle `.Nm ...' in SYNOPSIS
  998. . if \n[doc-in-synopsis-section] \{\
  999. . if "\*[doc-macro-name]"Nm" \{\
  1000. . br
  1001. . if !\n[doc-indent-synopsis] \{\
  1002. . doc-get-width "\*[doc-arg\n[doc-arg-ptr]]"
  1003. . nr doc-indent-synopsis ((\n[doc-width]u + 1u) * \n[doc-fixed-width]u)
  1004. . \}
  1005. . if !\n[doc-indent-synopsis-active] \{\
  1006. . in +\n[doc-indent-synopsis]u
  1007. . nr doc-indent-synopsis-active 1
  1008. . \}
  1009. . ti -\n[doc-indent-synopsis]u
  1010. . \}\}
  1011. . if "\*[doc-command-name]"" \
  1012. . ds doc-command-name "\*[doc-arg\n[doc-arg-ptr]]
  1013. .
  1014. . nop \*[doc-Nm-font]\c
  1015. . \}
  1016. . doc-print-recursive
  1017. . \}
  1018. ..
  1019. .
  1020. .
  1021. .\" NS Pa user macro
  1022. .\" NS pathname: `.Pa [arg ...]'
  1023. .\" NS
  1024. .\" NS modifies:
  1025. .\" NS doc-arg-ptr
  1026. .\" NS doc-curr-font
  1027. .\" NS doc-curr-size
  1028. .\" NS doc-macro-name
  1029. .\" NS
  1030. .\" NS width register `Pa' set in doc-common
  1031. .
  1032. .de Pa
  1033. . if !\n[doc-arg-limit] \{\
  1034. . ds doc-macro-name Pa
  1035. . doc-parse-args \$@
  1036. .
  1037. . \" default value
  1038. . if !\n[.$] \
  1039. . nop \*[doc-Pa-font]~\f[]\s[0]
  1040. . \}
  1041. .
  1042. . if !\n[doc-arg-limit] \
  1043. . return
  1044. .
  1045. . nr doc-arg-ptr +1
  1046. . doc-print-prefixes
  1047. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
  1048. . nr doc-curr-font \n[.f]
  1049. . nr doc-curr-size \n[.ps]
  1050. . nop \*[doc-Pa-font]\c
  1051. . if !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
  1052. . \" replace previous argument (Pa) with default value
  1053. . nr doc-arg-ptr -1
  1054. . ds doc-arg\n[doc-arg-ptr] ~
  1055. . nr doc-type\n[doc-arg-ptr] 2
  1056. . ds doc-space\n[doc-arg-ptr] "\*[doc-space]
  1057. .
  1058. . \" recompute space vector for remaining arguments
  1059. . nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr])
  1060. . nr doc-arg-limit \n[doc-arg-ptr]
  1061. . doc-parse-space-vector
  1062. . \}
  1063. . doc-print-recursive
  1064. . \}
  1065. . el \{\
  1066. . nop \*[doc-Pa-font]~\f[]\s[0]\c
  1067. . doc-print-and-reset
  1068. . \}
  1069. ..
  1070. .
  1071. .
  1072. .\" NS Sy user macro
  1073. .\" NS symbolics
  1074. .\" NS
  1075. .\" NS width register `Sy' set in doc-common
  1076. .
  1077. .als Sy doc-generic-macro
  1078. .ds doc-Sy-usage symbolic_text
  1079. .
  1080. .
  1081. .\" NS Me user macro
  1082. .\" NS menu entries
  1083. .\" NS
  1084. .\" NS width register `Me' set in doc-common
  1085. .
  1086. .als Me doc-generic-macro
  1087. .ds doc-Me-usage menu_entry
  1088. .
  1089. .
  1090. .\" NS Tn user macro
  1091. .\" NS trade name
  1092. .\" NS
  1093. .\" NS modifies:
  1094. .\" NS doc-arg-ptr
  1095. .\" NS doc-curr-font
  1096. .\" NS doc-curr-size
  1097. .\" NS doc-macro-name
  1098. .\" NS
  1099. .\" NS width register `Tn' set in doc-common
  1100. .
  1101. .de Tn
  1102. . if !\n[doc-arg-limit] \{\
  1103. . ie \n[.$] \{\
  1104. . ds doc-macro-name Tn
  1105. . doc-parse-args \$@
  1106. . \}
  1107. . el \
  1108. . tm Usage: .Tn trade_name ... (#\n[.c])
  1109. . \}
  1110. .
  1111. . if !\n[doc-arg-limit] \
  1112. . return
  1113. .
  1114. . nr doc-arg-ptr +1
  1115. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \{\
  1116. . nr doc-curr-font \n[.f]
  1117. . nr doc-curr-size \n[.ps]
  1118. . nop \)\*[doc-Tn-font-size]\c
  1119. . ie !\n[doc-is-reference] \{\
  1120. . nop \)\*[doc-Tn-font-shape]\c
  1121. . doc-print-recursive
  1122. . \}
  1123. . el \
  1124. . doc-do-references
  1125. . \}
  1126. . el \{\
  1127. . tm Usage: .Tn trade_name ... (#\n[.c])
  1128. . doc-reset-args
  1129. . \}
  1130. ..
  1131. .
  1132. .
  1133. .\" NS Va user macro
  1134. .\" NS variable name
  1135. .\" NS
  1136. .\" NS width register `Va' set in doc-common
  1137. .
  1138. .als Va doc-generic-macro
  1139. .ds doc-Va-usage variable_name
  1140. .
  1141. .
  1142. .\" NS No user macro
  1143. .\" NS normal text macro (default text style if mess up)
  1144. .\" NS
  1145. .\" NS width register `No' set in doc-common
  1146. .
  1147. .als No doc-generic-macro
  1148. .ds doc-No-usage normal_text
  1149. .
  1150. .
  1151. .\" NS doc-quote-left global string
  1152. .\" NS left quotation character for `doc-enclose-string' and
  1153. .\" NS `doc-enclose-open'
  1154. .
  1155. .ds doc-quote-left
  1156. .
  1157. .
  1158. .\" NS doc-quote-right global string
  1159. .\" NS right quotation character for `doc-enclose-string' and
  1160. .\" NS `doc-enclose-close'
  1161. .
  1162. .ds doc-quote-right
  1163. .
  1164. .
  1165. .\" NS Op user macro
  1166. .\" NS option expression (i.e., enclose string in square brackets)
  1167. .\" NS
  1168. .\" NS modifies:
  1169. .\" NS doc-macro-name
  1170. .\" NS doc-quote-left
  1171. .\" NS doc-quote-right
  1172. .\" NS
  1173. .\" NS width register `Op' set in doc-common
  1174. .
  1175. .de Op
  1176. . if !\n[doc-arg-limit] \
  1177. . ds doc-macro-name Op
  1178. .
  1179. . ds doc-quote-left "\*[doc-left-bracket]
  1180. . ds doc-quote-right "\*[doc-right-bracket]
  1181. .
  1182. . doc-enclose-string \$@
  1183. ..
  1184. .
  1185. .
  1186. .\" NS Aq user macro
  1187. .\" NS enclose string in angle brackets
  1188. .\" NS
  1189. .\" NS modifies:
  1190. .\" NS doc-macro-name
  1191. .\" NS doc-quote-left
  1192. .\" NS doc-quote-right
  1193. .\" NS
  1194. .\" NS width register `Aq' set in doc-common
  1195. .
  1196. .de Aq
  1197. . if !\n[doc-arg-limit] \
  1198. . ds doc-macro-name Aq
  1199. .
  1200. . ie "\*[doc-macro-name]"An" \{\
  1201. . ds doc-quote-left <
  1202. . ds doc-quote-right >
  1203. . \}
  1204. . el \{\
  1205. . ds doc-quote-left \[la]
  1206. . ds doc-quote-right \[ra]
  1207. . \}
  1208. .
  1209. . doc-enclose-string \$@
  1210. ..
  1211. .
  1212. .
  1213. .\" NS Bq user macro
  1214. .\" NS enclose string in square brackets
  1215. .\" NS
  1216. .\" NS modifies:
  1217. .\" NS doc-macro-name
  1218. .\" NS doc-quote-left
  1219. .\" NS doc-quote-right
  1220. .\" NS
  1221. .\" NS width register `Bq' set in doc-common
  1222. .
  1223. .de Bq
  1224. . if !\n[doc-arg-limit] \
  1225. . ds doc-macro-name Bq
  1226. .
  1227. . ds doc-quote-left "\*[doc-left-bracket]
  1228. . ds doc-quote-right "\*[doc-right-bracket]
  1229. .
  1230. . doc-enclose-string \$@
  1231. ..
  1232. .
  1233. .
  1234. .\" NS Brq user macro
  1235. .\" NS enclose string in braces
  1236. .\" NS
  1237. .\" NS modifies:
  1238. .\" NS doc-macro-name
  1239. .\" NS doc-quote-left
  1240. .\" NS doc-quote-right
  1241. .\" NS
  1242. .\" NS width register `Brq' set in doc-common
  1243. .
  1244. .de Brq
  1245. . if !\n[doc-arg-limit] \
  1246. . ds doc-macro-name Brq
  1247. .
  1248. . ds doc-quote-left {
  1249. . ds doc-quote-right }
  1250. .
  1251. . doc-enclose-string \$@
  1252. ..
  1253. .
  1254. .
  1255. .\" NS Dq user macro
  1256. .\" NS enclose string in double quotes
  1257. .\" NS
  1258. .\" NS modifies:
  1259. .\" NS doc-macro-name
  1260. .\" NS doc-quote-left
  1261. .\" NS doc-quote-right
  1262. .\" NS
  1263. .\" NS width register `Dq' set in doc-common
  1264. .
  1265. .de Dq
  1266. . if !\n[doc-arg-limit] \
  1267. . ds doc-macro-name Dq
  1268. .
  1269. . ds doc-quote-left "\*[Lq]
  1270. . ds doc-quote-right "\*[Rq]
  1271. .
  1272. . doc-enclose-string \$@
  1273. ..
  1274. .
  1275. .
  1276. .\" NS Eq user macro
  1277. .\" NS enclose string in user-defined quotes (args 1 and 2)
  1278. .\" NS
  1279. .\" NS modifies:
  1280. .\" NS doc-macro-name
  1281. .\" NS doc-quote-left
  1282. .\" NS doc-quote-right
  1283. .\" NS
  1284. .\" NS width register `Eq' set in doc-common
  1285. .
  1286. .de Eq
  1287. . if !\n[doc-arg-limit] \
  1288. . ds doc-macro-name Eq
  1289. .
  1290. . ds doc-quote-left "\$1
  1291. . ds doc-quote-right "\$2
  1292. .
  1293. . shift 2
  1294. . doc-enclose-string \$@
  1295. ..
  1296. .
  1297. .
  1298. .\" NS Pq user macro
  1299. .\" NS enclose string in parentheses
  1300. .\" NS
  1301. .\" NS modifies:
  1302. .\" NS doc-macro-name
  1303. .\" NS doc-quote-left
  1304. .\" NS doc-quote-right
  1305. .\" NS
  1306. .\" NS width register `Pq' set in doc-common
  1307. .
  1308. .de Pq
  1309. . if !\n[doc-arg-limit] \
  1310. . ds doc-macro-name Pq
  1311. .
  1312. . ds doc-quote-left "\*[doc-left-parenthesis]
  1313. . ds doc-quote-right "\*[doc-right-parenthesis]
  1314. .
  1315. . doc-enclose-string \$@
  1316. ..
  1317. .
  1318. .
  1319. .\" NS Ql user macro
  1320. .\" NS quoted literal
  1321. .\"
  1322. .\" is in file doc-[dit|n]roff
  1323. .
  1324. .
  1325. .\" NS Qq user macro
  1326. .\" NS enclose string in straight double quotes
  1327. .\" NS
  1328. .\" NS modifies:
  1329. .\" NS doc-macro-name
  1330. .\" NS doc-quote-left
  1331. .\" NS doc-quote-right
  1332. .\" NS
  1333. .\" NS width register `Qq' set in doc-common
  1334. .
  1335. .de Qq
  1336. . if !\n[doc-arg-limit] \
  1337. . ds doc-macro-name Qq
  1338. .
  1339. . ds doc-quote-left "\*[q]
  1340. . ds doc-quote-right "\*[q]
  1341. .
  1342. . doc-enclose-string \$@
  1343. ..
  1344. .
  1345. .
  1346. .\" NS Sq user macro
  1347. .\" NS enclose string in single quotes
  1348. .\" NS
  1349. .\" NS modifies:
  1350. .\" NS doc-macro-name
  1351. .\" NS doc-quote-left
  1352. .\" NS doc-quote-right
  1353. .\" NS
  1354. .\" NS width register `Sq' set in doc-common
  1355. .
  1356. .de Sq
  1357. . if !\n[doc-arg-limit] \
  1358. . ds doc-macro-name Sq
  1359. .
  1360. . ds doc-quote-left "\*[doc-left-singlequote]
  1361. . ds doc-quote-right "\*[doc-right-singlequote]
  1362. .
  1363. . doc-enclose-string \$@
  1364. ..
  1365. .
  1366. .
  1367. .\" NS Es user macro
  1368. .\" NS set up arguments (i.e., the left and right quotation character as
  1369. .\" NS first and second argument) for .En call
  1370. .\" NS
  1371. .\" NS modifies:
  1372. .\" NS doc-arg-ptr
  1373. .\" NS doc-macro-name
  1374. .\" NS doc-quote-left
  1375. .\" NS doc-quote-right
  1376. .
  1377. .de Es
  1378. . if !\n[doc-arg-limit] \{\
  1379. . ie (\n[.$] > 2) \{\
  1380. . ds doc-macro-name Es
  1381. . doc-parse-args \$@
  1382. . \}
  1383. . el \{\
  1384. . ds doc-quote-left "\$1
  1385. . ds doc-quote-right "\$2
  1386. . \}\}
  1387. .
  1388. . if !\n[doc-arg-limit] \
  1389. . return
  1390. .
  1391. . nr doc-arg-ptr +1
  1392. . ds doc-quote-left "\*[doc-arg\n[doc-arg-ptr]]
  1393. . nr doc-arg-ptr +1
  1394. . ds doc-quote-right "\*[doc-arg\n[doc-arg-ptr]]
  1395. . nr doc-arg-ptr +1
  1396. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
  1397. . doc-do-\n[doc-type\n[doc-arg-ptr]]
  1398. . el \
  1399. . doc-print-and-reset
  1400. ..
  1401. .
  1402. .
  1403. .\" NS doc-have-slot global register (bool)
  1404. .\" NS set if `doc-enclose-string' has created a slot for closing
  1405. .\" NS delimiter
  1406. .
  1407. .nr doc-have-slot 0
  1408. .
  1409. .
  1410. .\" NS doc-enclose-string macro
  1411. .\" NS enclose string with given args (e.g. [ and ])
  1412. .\" NS
  1413. .\" NS modifies:
  1414. .\" NS doc-arg-ptr
  1415. .\" NS doc-argXXX
  1416. .\" NS doc-have-slot
  1417. .\" NS
  1418. .\" NS local variables:
  1419. .\" NS doc-reg-des
  1420. .\" NS doc-reg-des1
  1421. .\" NS doc-reg-des2
  1422. .\" NS
  1423. .\" NS requires:
  1424. .\" NS doc-quote-left
  1425. .\" NS doc-quote-right
  1426. .
  1427. .de doc-enclose-string
  1428. . if \n[doc-in-synopsis-section] \
  1429. . doc-set-hard-space
  1430. .
  1431. . if !\n[doc-arg-limit] \{\
  1432. . ie \n[.$] \
  1433. . doc-parse-args \$@
  1434. . el \{\
  1435. . nop \)\*[doc-quote-left]\*[doc-quote-right]
  1436. . \}\}
  1437. .
  1438. . if !\n[doc-arg-limit] \
  1439. . return
  1440. .
  1441. . nr doc-curr-font \n[.f]
  1442. . nr doc-curr-size \n[.ps]
  1443. .
  1444. . nr doc-arg-ptr +1
  1445. . doc-print-prefixes
  1446. . \" the final `\)' prevents hyphenation in case the next character is `\%'
  1447. . nop \)\*[doc-quote-left]\)\c
  1448. . ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \{\
  1449. . \" last argument
  1450. . nop \)\*[doc-quote-right]\)\c
  1451. . doc-print-and-reset
  1452. . \}
  1453. . el \{\
  1454. . \" test whether last arguments are of type closing punctuation
  1455. . \" resp. suffix
  1456. . ie (\n[doc-type\n[doc-arg-limit]] == 3) \{\
  1457. . nr doc-reg-des (\n[doc-arg-limit] - 1)
  1458. . while (\n[doc-type\n[doc-reg-des]] == 3) \
  1459. . nr doc-reg-des -1
  1460. .
  1461. . \" prepend closing delimiter
  1462. . nr doc-reg-des +1
  1463. . ds doc-arg\n[doc-reg-des] "\*[doc-quote-right]\)\*[doc-arg\n[doc-reg-des]]
  1464. . \}
  1465. . el \{\
  1466. . \" test whether last arguments are macros which continue the line
  1467. . \" logically
  1468. . nr doc-reg-des \n[doc-arg-limit]
  1469. . while (\n[doc-reg-des] >= \n[doc-arg-ptr]) \{\
  1470. . if !\A\*[doc-arg\n[doc-reg-des]] \
  1471. . break
  1472. . if !d doc-after-\*[doc-arg\n[doc-reg-des]] \
  1473. . break
  1474. . nr doc-reg-des -1
  1475. . \}
  1476. .
  1477. . \" if there are no trailing macros to be skipped, append argument
  1478. . ie (\n[doc-reg-des] == \n[doc-arg-limit]) \
  1479. . doc-append-arg "\)\*[doc-quote-right]\)" 3
  1480. . el \{\
  1481. . \" if a previous call to `doc-enclose-string' has already created
  1482. . \" a slot, prepend argument
  1483. . ie \n[doc-have-slot] \
  1484. . ds doc-arg\n[doc-reg-des] "\*[doc-quote-right]\)\*[doc-arg\n[doc-reg-des]]
  1485. . el \{\
  1486. . \" we have to shift all arguments to the right
  1487. . nr doc-reg-des +1
  1488. . nr doc-reg-des1 \n[doc-arg-limit]
  1489. . nr doc-reg-des2 (\n[doc-arg-limit] + 1)
  1490. . while (\n[doc-reg-des1] >= \n[doc-reg-des]) \{\
  1491. . rn doc-arg\n[doc-reg-des1] doc-arg\n[doc-reg-des2]
  1492. . rnn doc-type\n[doc-reg-des1] doc-type\n[doc-reg-des2]
  1493. . rn doc-space\n[doc-reg-des1] doc-space\n[doc-reg-des2]
  1494. . nr doc-reg-des1 -1
  1495. . nr doc-reg-des2 -1
  1496. . \}
  1497. . nr doc-arg-limit +1
  1498. .
  1499. . \" finally, insert closing delimiter into the freed slot and
  1500. . \" recompute spacing vector
  1501. . ds doc-arg\n[doc-reg-des] "\)\*[doc-quote-right]\)
  1502. . nr doc-type\n[doc-reg-des] 3
  1503. . nr doc-num-args (\n[doc-arg-limit] - \n[doc-reg-des] + 1)
  1504. . nr doc-arg-limit (\n[doc-reg-des] - 1)
  1505. . doc-parse-space-vector
  1506. . nr doc-have-slot 1
  1507. . \}\}\}
  1508. .
  1509. . doc-do-\n[doc-type\n[doc-arg-ptr]]
  1510. . \}
  1511. .
  1512. . if \n[doc-in-synopsis-section] \
  1513. . doc-set-soft-space
  1514. ..
  1515. .
  1516. .
  1517. .\" NS En user macro
  1518. .\" NS enclose arguments with quotation characters set up with `.Es'
  1519. .
  1520. .als En doc-enclose-string
  1521. .
  1522. .
  1523. .\" NS Ao user macro
  1524. .\" NS angle open
  1525. .\" NS
  1526. .\" NS modifies:
  1527. .\" NS doc-macro-name
  1528. .\" NS doc-quote-left
  1529. .\" NS
  1530. .\" NS width register `Ao' set in doc-common
  1531. .
  1532. .de Ao
  1533. . if !\n[doc-arg-limit] \
  1534. . ds doc-macro-name Ao
  1535. .
  1536. . ie "\*[doc-macro-name]"An" \
  1537. . ds doc-quote-left <
  1538. . el \
  1539. . ds doc-quote-left \[la]
  1540. .
  1541. . doc-enclose-open \$@
  1542. ..
  1543. .
  1544. .
  1545. .\" NS Ac user macro
  1546. .\" NS angle close
  1547. .\" NS
  1548. .\" NS modifies:
  1549. .\" NS doc-macro-name
  1550. .\" NS doc-quote-right
  1551. .\" NS
  1552. .\" NS width register `Ac' set in doc-common
  1553. .
  1554. .de Ac
  1555. . if !\n[doc-arg-limit] \
  1556. . ds doc-macro-name Ac
  1557. .
  1558. . ie "\*[doc-macro-name]"An" \
  1559. . ds doc-quote-right >
  1560. . el \
  1561. . ds doc-quote-right \[ra]
  1562. .
  1563. . doc-enclose-close \$@
  1564. ..
  1565. .
  1566. .
  1567. .\" NS Bo user macro
  1568. .\" NS bracket open
  1569. .\" NS
  1570. .\" NS modifies:
  1571. .\" NS doc-macro-name
  1572. .\" NS doc-quote-left
  1573. .\" NS
  1574. .\" NS width register `Bo' set in doc-common
  1575. .
  1576. .de Bo
  1577. . if !\n[doc-arg-limit] \
  1578. . ds doc-macro-name Bo
  1579. .
  1580. . ds doc-quote-left "\*[doc-left-bracket]
  1581. .
  1582. . doc-enclose-open \$@
  1583. ..
  1584. .
  1585. .
  1586. .\" NS Bc user macro
  1587. .\" NS bracket close
  1588. .\" NS
  1589. .\" NS modifies:
  1590. .\" NS doc-macro-name
  1591. .\" NS doc-quote-right
  1592. .\" NS
  1593. .\" NS width register `Bc' set in doc-common
  1594. .
  1595. .de Bc
  1596. . if !\n[doc-arg-limit] \
  1597. . ds doc-macro-name Bc
  1598. .
  1599. . ds doc-quote-right "\*[doc-right-bracket]
  1600. .
  1601. . doc-enclose-close \$@
  1602. ..
  1603. .
  1604. .
  1605. .\" NS Bro user macro
  1606. .\" NS brace open
  1607. .\" NS
  1608. .\" NS modifies:
  1609. .\" NS doc-macro-name
  1610. .\" NS doc-quote-left
  1611. .\" NS
  1612. .\" NS width register `Bro' set in doc-common
  1613. .
  1614. .de Bro
  1615. . if !\n[doc-arg-limit] \
  1616. . ds doc-macro-name Bo
  1617. .
  1618. . ds doc-quote-left {
  1619. .
  1620. . doc-enclose-open \$@
  1621. ..
  1622. .
  1623. .
  1624. .\" NS Brc user macro
  1625. .\" NS brace close
  1626. .\" NS
  1627. .\" NS modifies:
  1628. .\" NS doc-macro-name
  1629. .\" NS doc-quote-right
  1630. .\" NS
  1631. .\" NS width register `Brc' set in doc-common
  1632. .
  1633. .de Brc
  1634. . if !\n[doc-arg-limit] \
  1635. . ds doc-macro-name Bc
  1636. .
  1637. . ds doc-quote-right }
  1638. .
  1639. . doc-enclose-close \$@
  1640. ..
  1641. .
  1642. .
  1643. .\" NS Do user macro
  1644. .\" NS double quote open
  1645. .\" NS
  1646. .\" NS modifies:
  1647. .\" NS doc-macro-name
  1648. .\" NS doc-quote-left
  1649. .\" NS
  1650. .\" NS width register `Do' set in doc-common
  1651. .
  1652. .de Do
  1653. . if !\n[doc-arg-limit] \
  1654. . ds doc-macro-name Do
  1655. .
  1656. . ds doc-quote-left "\*[Lq]
  1657. .
  1658. . doc-enclose-open \$@
  1659. ..
  1660. .
  1661. .
  1662. .\" NS Dc user macro
  1663. .\" NS double quote close
  1664. .\" NS
  1665. .\" NS modifies:
  1666. .\" NS doc-macro-name
  1667. .\" NS doc-quote-right
  1668. .\" NS
  1669. .\" NS width register `Dc' set in doc-common
  1670. .
  1671. .de Dc
  1672. . if !\n[doc-arg-limit] \
  1673. . ds doc-macro-name Dc
  1674. .
  1675. . ds doc-quote-right "\*[Rq]
  1676. .
  1677. . doc-enclose-close \$@
  1678. ..
  1679. .
  1680. .
  1681. .\" NS Eo user macro
  1682. .\" NS enclose open (using first argument as beginning of enclosure)
  1683. .\" NS
  1684. .\" NS modifies:
  1685. .\" NS doc-macro-name
  1686. .\" NS doc-quote-left
  1687. .\" NS
  1688. .\" NS width register `Eo' set in doc-common
  1689. .
  1690. .de Eo
  1691. . if !\n[doc-arg-limit] \
  1692. . ds doc-macro-name Eo
  1693. .
  1694. . ds doc-quote-left "\$1
  1695. .
  1696. . shift
  1697. . doc-enclose-open \$@
  1698. ..
  1699. .
  1700. .
  1701. .\" NS Ec user macro
  1702. .\" NS enclose close (using first argument as end of enclosure)
  1703. .\" NS
  1704. .\" NS modifies:
  1705. .\" NS doc-macro-name
  1706. .\" NS doc-quote-right
  1707. .\" NS
  1708. .\" NS width register `Ec' set in doc-common
  1709. .
  1710. .de Ec
  1711. . if !\n[doc-arg-limit] \
  1712. . ds doc-macro-name Ec
  1713. .
  1714. . ds doc-quote-right "\$1
  1715. .
  1716. . shift
  1717. . doc-enclose-close \$@
  1718. ..
  1719. .
  1720. .
  1721. .\" NS Oo user macro
  1722. .\" NS option open
  1723. .\" NS
  1724. .\" NS modifies:
  1725. .\" NS doc-macro-name
  1726. .\" NS doc-quote-left
  1727. .\" NS
  1728. .\" NS width register `Oo' set in doc-common
  1729. .
  1730. .de Oo
  1731. . if !\n[doc-arg-limit] \
  1732. . ds doc-macro-name Oo
  1733. .
  1734. . ds doc-quote-left [
  1735. .
  1736. . doc-enclose-open \$@
  1737. ..
  1738. .
  1739. .
  1740. .\" NS Oc user macro
  1741. .\" NS option close
  1742. .\" NS
  1743. .\" NS modifies:
  1744. .\" NS doc-macro-name
  1745. .\" NS doc-quote-right
  1746. .\" NS
  1747. .\" NS width register `Oc' set in doc-common
  1748. .
  1749. .de Oc
  1750. . if !\n[doc-arg-limit] \
  1751. . ds doc-macro-name Oc
  1752. .
  1753. . ds doc-quote-right ]
  1754. .
  1755. . doc-enclose-close \$@
  1756. ..
  1757. .
  1758. .
  1759. .\" NS Po user macro
  1760. .\" NS parenthesis open
  1761. .\" NS
  1762. .\" NS modifies:
  1763. .\" NS doc-macro-name
  1764. .\" NS doc-quote-left
  1765. .\" NS
  1766. .\" NS width register `Po' set in doc-common
  1767. .
  1768. .de Po
  1769. . if !\n[doc-arg-limit] \
  1770. . ds doc-macro-name Po
  1771. .
  1772. . ds doc-quote-left "\*[doc-left-parenthesis]
  1773. .
  1774. . doc-enclose-open \$@
  1775. ..
  1776. .
  1777. .
  1778. .\" NS Pc user macro
  1779. .\" NS parenthesis close
  1780. .\" NS
  1781. .\" NS modifies:
  1782. .\" NS doc-macro-name
  1783. .\" NS doc-quote-right
  1784. .\" NS
  1785. .\" NS width register `Pc' set in doc-common
  1786. .
  1787. .de Pc
  1788. . if !\n[doc-arg-limit] \
  1789. . ds doc-macro-name Pc
  1790. .
  1791. . ds doc-quote-right "\*[doc-right-parenthesis]
  1792. .
  1793. . doc-enclose-close \$@
  1794. ..
  1795. .
  1796. .
  1797. .\" NS Qo user macro
  1798. .\" NS straight double quote open
  1799. .\" NS
  1800. .\" NS modifies:
  1801. .\" NS doc-macro-name
  1802. .\" NS doc-quote-left
  1803. .\" NS
  1804. .\" NS width register `Qo' set in doc-common
  1805. .
  1806. .de Qo
  1807. . if !\n[doc-arg-limit] \
  1808. . ds doc-macro-name Qo
  1809. .
  1810. . ds doc-quote-left "\*[q]
  1811. .
  1812. . doc-enclose-open \$@
  1813. ..
  1814. .
  1815. .
  1816. .\" NS Qc user macro
  1817. .\" NS straight double quote close
  1818. .\" NS
  1819. .\" NS modifies:
  1820. .\" NS doc-macro-name
  1821. .\" NS doc-quote-right
  1822. .\" NS
  1823. .\" NS width register `Qc' set in doc-common
  1824. .
  1825. .de Qc
  1826. . if !\n[doc-arg-limit] \
  1827. . ds doc-macro-name Qc
  1828. .
  1829. . ds doc-quote-right "\*[q]
  1830. .
  1831. . doc-enclose-close \$@
  1832. ..
  1833. .
  1834. .
  1835. .\" NS So user macro
  1836. .\" NS single quote open
  1837. .\" NS
  1838. .\" NS modifies:
  1839. .\" NS doc-macro-name
  1840. .\" NS doc-quote-left
  1841. .\" NS
  1842. .\" NS width register `So' set in doc-common
  1843. .
  1844. .de So
  1845. . if !\n[doc-arg-limit] \
  1846. . ds doc-macro-name So
  1847. .
  1848. . ds doc-quote-left "\*[doc-left-singlequote]
  1849. .
  1850. . doc-enclose-open \$@
  1851. ..
  1852. .
  1853. .
  1854. .\" NS Sc user macro
  1855. .\" NS single quote close
  1856. .\" NS
  1857. .\" NS modifies:
  1858. .\" NS doc-macro-name
  1859. .\" NS doc-quote-right
  1860. .\" NS
  1861. .\" NS width register `Sc' set in doc-common
  1862. .
  1863. .de Sc
  1864. . if !\n[doc-arg-limit] \
  1865. . ds doc-macro-name Sc
  1866. .
  1867. . ds doc-quote-right "\*[doc-right-singlequote]
  1868. .
  1869. . doc-enclose-close \$@
  1870. ..
  1871. .
  1872. .
  1873. .\" NS Xo user macro
  1874. .\" NS extend open
  1875. .\" NS
  1876. .\" NS modifies:
  1877. .\" NS doc-macro-name
  1878. .\" NS doc-quote-left
  1879. .\" NS
  1880. .\" NS width register `Xo' set in doc-common
  1881. .
  1882. .de Xo
  1883. . if !\n[doc-arg-limit] \
  1884. . ds doc-macro-name Xo
  1885. .
  1886. . ds doc-quote-left
  1887. .
  1888. . doc-enclose-open \$@
  1889. ..
  1890. .
  1891. .
  1892. .\" NS Xc user macro
  1893. .\" NS extend close
  1894. .\" NS
  1895. .\" NS modifies:
  1896. .\" NS doc-macro-name
  1897. .\" NS doc-quote-right
  1898. .\" NS
  1899. .\" NS width register `Xc' set in doc-common
  1900. .
  1901. .de Xc
  1902. . if !\n[doc-arg-limit] \
  1903. . ds doc-macro-name Xc
  1904. .
  1905. . ds doc-quote-right
  1906. .
  1907. . doc-enclose-close \$@
  1908. ..
  1909. .
  1910. .
  1911. .\" NS doc-nesting-level global register
  1912. .\" NS used by `doc-enclose-open' and `doc-enclose-close'
  1913. .
  1914. .nr doc-nesting-level 0
  1915. .
  1916. .
  1917. .\" NS doc-in-list global register (bool)
  1918. .\" NS whether we are in (logical) .It
  1919. .
  1920. .nr doc-in-list 0
  1921. .
  1922. .
  1923. .\" NS doc-enclose-open macro
  1924. .\" NS enclose string open
  1925. .\" NS
  1926. .\" NS modifies:
  1927. .\" NS doc-arg-ptr
  1928. .\" NS doc-nesting-level
  1929. .
  1930. .de doc-enclose-open
  1931. . if !\n[doc-arg-limit] \
  1932. . doc-parse-args \$@
  1933. .
  1934. . nr doc-arg-ptr +1
  1935. . doc-print-prefixes
  1936. . nr doc-arg-ptr -1
  1937. .
  1938. . nop \)\*[doc-quote-left]\)\c
  1939. .
  1940. . \" start enclosure box
  1941. . box doc-enclosure-box\n[doc-nesting-level]
  1942. . ev doc-enclosure-env\n[doc-nesting-level]
  1943. . evc 0
  1944. . in 0
  1945. . nf
  1946. . \" we insert something to make .chop always work
  1947. . nop \&\c
  1948. .
  1949. . \" increase nesting level *after* parsing of arguments
  1950. . nr doc-nesting-level +1
  1951. .
  1952. . if \n[doc-arg-limit] \{\
  1953. . nr doc-arg-ptr +1
  1954. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
  1955. . doc-print-recursive
  1956. . el \
  1957. . doc-reset-args
  1958. . \}
  1959. ..
  1960. .
  1961. .
  1962. .\" NS doc-enclose-close macro
  1963. .\" NS enclose string close
  1964. .\" NS
  1965. .\" NS modifies:
  1966. .\" NS doc-nesting-level
  1967. .
  1968. .de doc-enclose-close
  1969. . nr doc-nesting-level -1
  1970. .
  1971. . \" finish enclosure box
  1972. . br
  1973. . ev
  1974. . box
  1975. . chop doc-enclosure-box\n[doc-nesting-level]
  1976. . unformat doc-enclosure-box\n[doc-nesting-level]
  1977. .
  1978. . nh
  1979. . nop \*[doc-enclosure-box\n[doc-nesting-level]]\c
  1980. . nop \)\*[doc-quote-right]\)\c
  1981. .
  1982. . if !\n[doc-arg-limit] \{\
  1983. . doc-parse-args \$@
  1984. .
  1985. . if !\n[.$] \
  1986. . doc-print-and-reset
  1987. . \}
  1988. .
  1989. . if \n[doc-arg-limit] \{\
  1990. . ie (\n[doc-arg-limit] > \n[doc-arg-ptr]) \{\
  1991. . nop \)\*[doc-space\n[doc-arg-ptr]]\c
  1992. . nr doc-arg-ptr +1
  1993. . doc-print-recursive
  1994. . \}
  1995. . el \
  1996. . doc-print-and-reset
  1997. . \}
  1998. .
  1999. . \" shall we finish .It macro?
  2000. . if !"\*[doc-macro-name]"It" \
  2001. . if \n[doc-in-list] \
  2002. . if !\n[doc-nesting-level] \
  2003. . doc-\*[doc-list-type-stack\n[doc-list-depth]]
  2004. ..
  2005. .
  2006. .
  2007. .\" NS Pf user macro
  2008. .\" NS prefix: `.Pf prefix arg ...'
  2009. .\" NS
  2010. .\" NS modifies:
  2011. .\" NS doc-arg-ptr
  2012. .\" NS doc-macro-name
  2013. .\" NS doc-quote-left
  2014. .\" NS
  2015. .\" NS width register `Pf' set in doc-common
  2016. .
  2017. .de Pf
  2018. . if !\n[doc-arg-limit] \
  2019. . ds doc-macro-name Pf
  2020. .
  2021. . ie \n[doc-arg-limit] \{\
  2022. . ie ((\n[doc-arg-limit] - \n[doc-arg-ptr]) > 1) \{\
  2023. . nr doc-arg-ptr +1
  2024. . nop \)\*[doc-arg\n[doc-arg-ptr]]\c
  2025. . \}
  2026. . el \
  2027. . tm mdoc warning: .Pf: trailing prefix (#\n[.c])
  2028. . \}
  2029. . el \{\
  2030. . nop \)\$1\)\c
  2031. . shift
  2032. . ie \n[.$] \
  2033. . doc-parse-args \$@
  2034. . el \{\
  2035. . tm mdoc warning: .Pf: missing arguments (#\n[.c])
  2036. . nop \)
  2037. . \}\}
  2038. .
  2039. . if \n[doc-arg-limit] \{\
  2040. . nr doc-arg-ptr +1
  2041. . ie (\n[doc-arg-limit] < \n[doc-arg-ptr]) \
  2042. . doc-print-and-reset
  2043. . el \
  2044. . doc-do-\n[doc-type\n[doc-arg-ptr]]
  2045. . \}
  2046. ..
  2047. .
  2048. .
  2049. .\" NS Ns user macro
  2050. .\" NS remove space (space removal done by `doc-parse-args')
  2051. .\" NS
  2052. .\" NS modifies:
  2053. .\" NS doc-argXXX
  2054. .\" NS doc-macro-name
  2055. .\" NS
  2056. .\" NS width register `Ns' set in doc-common
  2057. .
  2058. .de Ns
  2059. . if !\n[doc-arg-limit] \{\
  2060. . ie \n[.$] \{\
  2061. . ds doc-macro-name Ns
  2062. . doc-parse-args \$@
  2063. . \}
  2064. . el \
  2065. . tm Usage: .Ns must be called with arguments (#\n[.c])
  2066. . \}
  2067. .
  2068. . if \n[doc-arg-limit] \{\
  2069. . nr doc-arg-ptr +1
  2070. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
  2071. . doc-print-recursive
  2072. . el \
  2073. . doc-reset-args
  2074. . \}
  2075. ..
  2076. .
  2077. .
  2078. .\" NS Ap user macro
  2079. .\" NS append an apostrophe
  2080. .\" NS
  2081. .\" NS width register `Ap' set in doc-common
  2082. .
  2083. .de Ap
  2084. . ie !\n[doc-arg-limit] \
  2085. . tm Usage: `Ap' cannot be first macro on a line (no `.Ap') (#\n[.c])
  2086. . el \{\
  2087. . nop \)'\)\c
  2088. . nr doc-arg-ptr +1
  2089. . ie (\n[doc-arg-limit] >= \n[doc-arg-ptr]) \
  2090. . doc-print-recursive
  2091. . el \
  2092. . doc-reset-args
  2093. . \}
  2094. ..
  2095. .
  2096. .
  2097. .\" NS doc-space global string
  2098. .\" NS current inter-argument space
  2099. .
  2100. .ds doc-space "\*[doc-soft-space]
  2101. .
  2102. .
  2103. .\" NS doc-soft-space constant string
  2104. .\" NS soft (stretchable) space (defined in doc-common)
  2105. .
  2106. .
  2107. .\" NS doc-hard-space constant string
  2108. .\" NS hard (unpaddable) space (defined in doc-common)
  2109. .
  2110. .
  2111. .\" NS doc-set-hard-space macro
  2112. .\" NS set current space string to hard (unpaddable) space.
  2113. .\" NS
  2114. .\" NS modifies:
  2115. .\" NS doc-saved-space
  2116. .\" NS doc-space
  2117. .
  2118. .de doc-set-hard-space
  2119. . ie "\*[doc-space]"" \
  2120. . ds doc-saved-space "\*[doc-hard-space]
  2121. . el \
  2122. . ds doc-space "\*[doc-hard-space]
  2123. ..
  2124. .
  2125. .
  2126. .\" NS doc-set-soft-space macro
  2127. .\" NS set current space string to soft space
  2128. .\" NS
  2129. .\" NS modifies:
  2130. .\" NS doc-saved-space
  2131. .\" NS doc-space
  2132. .
  2133. .de doc-set-soft-space
  2134. . ie "\*[doc-space]"" \
  2135. . ds doc-saved-space "\*[doc-soft-space]
  2136. . el \
  2137. . ds doc-space "\*[doc-soft-space]
  2138. ..
  2139. .
  2140. .
  2141. .\" NS doc-space-mode global register (bool)
  2142. .\" NS default is one (space mode on)
  2143. .
  2144. .nr doc-space-mode 1
  2145. .
  2146. .
  2147. .\" NS doc-saved-space global string
  2148. .\" NS saved value of `doc-space'
  2149. .
  2150. .ds doc-saved-space "\*[doc-space]
  2151. .
  2152. .
  2153. .\" NS doc-have-space global register (bool)
  2154. .\" NS set if last command was horizontal space
  2155. .
  2156. .nr doc-have-space 0
  2157. .
  2158. .
  2159. .\" NS Sm user macro
  2160. .\" NS space mode (`.Sm'/`.Sm on'/`.Sm off')
  2161. .\" NS
  2162. .\" NS without argument, toggle space mode
  2163. .\" NS
  2164. .\" NS modifies:
  2165. .\" NS doc-arg-limit
  2166. .\" NS doc-arg-ptr
  2167. .\" NS doc-argXXX
  2168. .\" NS doc-macro-name
  2169. .\" NS doc-num-args
  2170. .\" NS doc-saved-space
  2171. .\" NS doc-space
  2172. .\" NS doc-space-mode
  2173. .\" NS doc-spaceXXX
  2174. .\" NS
  2175. .\" NS local variables:
  2176. .\" NS doc-reg-Sm
  2177. .\" NS
  2178. .\" NS width register `Sm' set in doc-common
  2179. .
  2180. .de Sm
  2181. . ie \n[doc-have-space] \
  2182. . nr doc-reg-Sm 0
  2183. . el \
  2184. . nr doc-reg-Sm 1
  2185. .
  2186. . if !\n[doc-arg-limit] \{\
  2187. . ie \n[.$] \{\
  2188. . ds doc-macro-name Sm
  2189. . doc-parse-args \$@
  2190. . \}
  2191. . el \{\
  2192. . ie \n[doc-space-mode] \{\
  2193. . ds doc-saved-space "\*[doc-space]
  2194. . ds doc-space
  2195. . nr doc-space-mode 0
  2196. . \}
  2197. . el \{\
  2198. . ds doc-space "\*[doc-saved-space]
  2199. . nr doc-space-mode 1
  2200. .
  2201. . \" finish line only if it is interrupted and `doc-have-space'
  2202. . \" isn't set
  2203. . if \n[doc-reg-Sm] \
  2204. . if \n[.int] \
  2205. . nop \)
  2206. . \}
  2207. . \}\}
  2208. .
  2209. . if !\n[doc-arg-limit] \
  2210. . return
  2211. .
  2212. . nr doc-arg-ptr +1
  2213. .
  2214. . \" avoid a warning message in case `Sm' is the last parameter
  2215. . if !d doc-arg\n[doc-arg-ptr] \
  2216. . ds doc-arg\n[doc-arg-ptr]
  2217. .
  2218. . ie "\*[doc-arg\n[doc-arg-ptr]]"on" \{\
  2219. . ds doc-space "\*[doc-saved-space]
  2220. . nr doc-space-mode 1
  2221. . \}
  2222. . el \{\
  2223. . ie "\*[doc-arg\n[doc-arg-ptr]]"off" \{\
  2224. . ds doc-saved-space "\*[doc-space]
  2225. . ds doc-space
  2226. . nr doc-space-mode 0
  2227. . \}
  2228. . el \{\
  2229. . \" no argument for Sm
  2230. . nr doc-arg-ptr -1
  2231. . ie \n[doc-space-mode] \{\
  2232. . ds doc-saved-space "\*[doc-space]
  2233. . ds doc-space
  2234. . nr doc-space-mode 0
  2235. . \}
  2236. . el \{\
  2237. . ds doc-space "\*[doc-saved-space]
  2238. . nr doc-space-mode 1
  2239. . \}
  2240. . \}\}
  2241. .
  2242. . ie \n[doc-space-mode] \{\
  2243. . \" recompute space vector for remaining arguments
  2244. . nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr])
  2245. . nr doc-arg-limit \n[doc-arg-ptr]
  2246. . if \n[doc-num-args] \
  2247. . doc-parse-space-vector
  2248. .
  2249. . \" finish line only if it is interrupted and `doc-have-space'
  2250. . \" isn't set
  2251. . if \n[doc-reg-Sm] \
  2252. . if \n[.int] \
  2253. . nop \)
  2254. . \}
  2255. . el \{\
  2256. . \" reset remaining space vector elements
  2257. . nr doc-reg-Sm (\n[doc-arg-ptr] + 1)
  2258. . while (\n[doc-reg-Sm] <= \n[doc-arg-limit]) \{\
  2259. . ds doc-space\n[doc-reg-Sm]
  2260. . nr doc-reg-Sm +1
  2261. . \" the body of a `while' request must end with the fitting `\}'!
  2262. . \}
  2263. . \}
  2264. .
  2265. . \" do we have parameters to print?
  2266. . ie (\n[doc-arg-limit] > \n[doc-arg-ptr]) \{\
  2267. . \" skip `Sm' argument
  2268. . nr doc-arg-ptr +1
  2269. . doc-print-recursive
  2270. . \}
  2271. . el \
  2272. . doc-reset-args
  2273. ..
  2274. .
  2275. .
  2276. .\" NS doc-arg-type immediate register
  2277. .\" NS argument type (macro=1, string=2, punctuation suffix=3,
  2278. .\" NS punctuation prefix=4)
  2279. .
  2280. .nr doc-arg-type 0
  2281. .
  2282. .
  2283. .\" NS doc-get-arg-type macro
  2284. .\" NS get argument type
  2285. .\" NS
  2286. .\" NS this macro expects the width of the argument in `doc-width'
  2287. .\" NS
  2288. .\" NS modifies:
  2289. .\" NS doc-arg-type
  2290. .
  2291. .de doc-get-arg-type
  2292. . nr doc-arg-type 2
  2293. .
  2294. . if ((\n[doc-width] < 4) & \A\$1) \{\
  2295. . ie (\n[doc-width] == 1) \{\
  2296. . if r doc-punct\$1 \
  2297. . nr doc-arg-type \n[doc-punct\$1]
  2298. . \}
  2299. . el \
  2300. . if r \$1 \
  2301. . if d \$1 \
  2302. . nr doc-arg-type 1
  2303. . \}
  2304. ..
  2305. .
  2306. .
  2307. .\" NS doc-get-arg-type* macro
  2308. .\" NS similar to as `doc-get-arg-type' but uses doc-argXXX strings
  2309. .\" NS
  2310. .\" NS this macro sets the `doc-width' register using the `length' request
  2311. .\" NS to get the number of characters in a string literally
  2312. .\" NS
  2313. .\" NS modifies:
  2314. .\" NS doc-arg-type
  2315. .\" NS doc-width
  2316. .
  2317. .de doc-get-arg-type*
  2318. . nr doc-arg-type 2
  2319. . length doc-width "\*[doc-arg\$1]
  2320. .
  2321. . if ((\n[doc-width] < 4) & \A\*[doc-arg\$1]) \{\
  2322. . ie (\n[doc-width] == 1) \{\
  2323. . if r doc-punct\*[doc-arg\$1] \
  2324. . nr doc-arg-type \n[doc-punct\*[doc-arg\$1]]
  2325. . \}
  2326. . el \
  2327. . if r \*[doc-arg\$1] \
  2328. . if d \*[doc-arg\$1] \
  2329. . nr doc-arg-type 1
  2330. . \}
  2331. ..
  2332. .
  2333. .
  2334. .\" NS doc-set-spacing-1 macro
  2335. .\" NS set spacing for macros
  2336. .\" NS
  2337. .\" NS…