├── .gitignore
├── tmac
├── pca-bib.tmac
├── pca-t2p-ix.tmac
├── pca-lsm.tmac
├── pca-verb.tmac
├── pca-t2p-eval-lua.tmac
├── pca-dc.tmac
├── pca.tmac
├── pca-t2p-toc.tmac
├── pca-eval-lua.tmac
├── pca-eval-js.tmac
├── pca-tag.tmac
├── pca-t2p-toc-lua.tmac
├── pca-t2p-man.tmac
├── pca-t2p-man-lua.tmac
├── pca-img.tmac
├── pca-eval-lisp.tmac
├── pca-eval.tmac
├── pca-t2p-ix-lua.tmac
├── pca-toc.tmac
├── pca-ix.tmac
└── pca-t2p-info-lua.tmac
├── bin
├── mpca
└── adoc2ms
└── README.adoc
/.gitignore:
--------------------------------------------------------------------------------
1 | #last modified 2020-11-07
2 | *.1
3 | *.log
4 | *.lua
5 | *.pdf
6 | *.png
7 | *.ps
8 | *.sav
9 | *.tmac.*
10 | *.txt.so
11 | *~
12 | .troff*
13 | ?.ms
14 | [!io]*-Z-*
15 | [!io]*.html
16 | docs/*[!ls]
17 |
--------------------------------------------------------------------------------
/tmac/pca-bib.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-17
2 | .\" created 2020-12-17
3 | .
4 | .if d BIB .nx
5 | .
6 | .de BIB
7 | .ie !\\n[BIBnum] .nr BIBnum 1
8 | .el .nr BIBnum \\n[BIBnum]+1
9 | .sp .5v
10 | .TAG \\$1 \\n[BIBnum]
11 | .LP
12 | [\\n[BIBnum]]
13 | ..
14 |
--------------------------------------------------------------------------------
/bin/mpca:
--------------------------------------------------------------------------------
1 | # last modified 2021-11-08
2 | # created 2020-11-08
3 |
4 | f=${@:$(($#)):1}
5 |
6 | all_but_final_arg=${@:1:$(($#-1))}
7 |
8 | f_without_dir=${f##*/}
9 |
10 | f_basename=${f_without_dir%.*}
11 |
12 | soelim $f |
13 | preconv |
14 | groff -U -mpca $all_but_final_arg > $f_basename.ps
15 |
--------------------------------------------------------------------------------
/tmac/pca-t2p-ix.tmac:
--------------------------------------------------------------------------------
1 | .\" last change 2020-12-12
2 | .\" Dorai Sitaram
3 | .
4 | .if !\n[.troff2page] .nx
5 | .
6 | .de IX
7 | . pca:set-up-index
8 | . nr pca:ix-location +1
9 | . TAG __troff2page_index_\\n[pca:ix-location]
10 | . write pca:idx-stream \\\\indexentry{\\$*|pca:ix-function}{\\n[pca:ix-location]}
11 | ..
12 | .
13 | .mso pca-t2p-ix-\*[pca-eval-lang].tmac
14 |
--------------------------------------------------------------------------------
/tmac/pca-lsm.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-11-30
2 | .
3 | .if d pca:leading-spaces-macro .nx
4 | .
5 | .am par@reset
6 | .nr pca:obeylines 0
7 | ..
8 | .
9 | .de pca:leading-spaces-macro
10 | .ie \\n[pca:obeylines] .br
11 | .el \{\
12 | .ns
13 | .LP
14 | .if d lsmhook .lsmhook
15 | .nr pca:obeylines 1
16 | .\}
17 | \h'\\n[lsn]n'
18 | ..
19 | .
20 | .lsm pca:leading-spaces-macro
21 |
--------------------------------------------------------------------------------
/tmac/pca-verb.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2021-11-07
2 | .\" Dorai Sitaram
3 | .
4 | .if d EX .nx
5 | .
6 | .de EX
7 | . nr pca:EX-keep-within-page 0
8 | . if !'\\$1'' .nr pca:EX-keep-within-page 1
9 | . ie \\n[pca:EX-keep-within-page] .DS L verbatim
10 | . el .LD verbatim
11 | . ft C
12 | . if \\n[pca:EX-keep-within-page] .eo
13 | ..
14 | .
15 | .de EE
16 | . ec
17 | . DE
18 | ..
19 |
--------------------------------------------------------------------------------
/tmac/pca-t2p-eval-lua.tmac:
--------------------------------------------------------------------------------
1 | .\" last change 2020-12-13
2 | .
3 | .if !\n[.troff2page] .nx
4 | .
5 | .ig ##
6 | defrequest('pca:eval-process-snippets', function()
7 | read_troff_line()
8 | local f = String_table['pca:eval-file']()
9 | if probe_file(f) then dofile(f) end
10 | end)
11 |
12 | defrequest('pca:eval-load-snippet-if-poss', function()
13 | read_troff_line()
14 | local f = String_table['pca:eval-snippet-file']()
15 | if probe_file(f) then troff2page_file(f)
16 | else flag_missing_piece 'eval'
17 | end
18 | end)
19 | .##
20 |
--------------------------------------------------------------------------------
/tmac/pca-dc.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-12
2 | .
3 | .\" from www.tmac
4 | .
5 | .if \n[.troff2page] .nx
6 | .
7 | .de DC
8 | . in 0
9 | . if !d pca:dc-color .ds pca:dc-color black\"
10 | . if !'\\$3'' .ds pca:dc-color \\$3\"
11 | . ie n \
12 | . nop \\$1\c
13 | . el \{\
14 | . nr dummy \w'\\$1'u
15 | . nr pca:dc-height ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
16 | . char \[pca:dc-char] \m[\\*[pca:dc-color]]\s'\\n[pca:dc-height]u'\\$1
17 | . nop \v'\\n[.v]u'\\[pca:dc-char]\v'-\\n[.v]u'\c
18 | ' ti \w'\\[pca:dc-char]'u
19 | . \}
20 | . nop \\$2
21 | ..
22 |
--------------------------------------------------------------------------------
/tmac/pca.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2021-11-06
2 | .\" Dorai Sitaram
3 | .
4 | .mso ms.tmac
5 | .
6 | .if d pca:section-postlude .nx
7 | .
8 | .mso pca-toc.tmac
9 | .
10 | .mso pca-tag.tmac
11 | .
12 | .mso .groffrc.tmac
13 | .
14 | .de IX
15 | . mso pca-ix.tmac
16 | . IX \\$*
17 | ..
18 | .
19 | .de BIB
20 | . rm BIB
21 | . mso pca-bib.tmac
22 | . BIB \\$*
23 | ..
24 | .
25 | .de EX
26 | . rm EX
27 | . mso pca-verb.tmac
28 | . EX \\$*
29 | ..
30 | .
31 | .de eval
32 | . mso pca-eval.tmac
33 | . eval
34 | ..
35 | .
36 | .if !d IMG \{\
37 | . de IMG
38 | . rm IMG
39 | . mso pca-img.tmac
40 | . IMG \\$*
41 | . .
42 | .\}
43 | .
44 | .if !d DC \{\
45 | . de DC
46 | . rm DC
47 | . mso pca-dc.tmac
48 | . DC \\$*
49 | . .
50 | .\}
51 |
--------------------------------------------------------------------------------
/tmac/pca-t2p-toc.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2021-11-07
2 | .\" Dorai Sitaram
3 | .
4 | .if !\n[.troff2page] .nx
5 | .
6 | .am ToC
7 | . TAG __troff2page_toc_end
8 | ..
9 | .
10 | .de pca:write-toc-line
11 | . write pca:toc-stream .TOCLINE \\n[pca:toc-header-level] \\n[pca:toc-count] \\*[SN-STYLE]
12 | ..
13 | .
14 | .de TOCLINE
15 | . nr pca:this-tocentry-level \\$1
16 | . nr pca:this-tocentry-level -1
17 | . nr pca:toc-snippet-count \\$2
18 | . shift 2
19 | . ds pca:sec-num "\\$@
20 | . nr pca:this-indent \\n[pca:DI]u
21 | . nr pca:this-indent (\\n[pca:this-indent]*\\n[pca:this-tocentry-level])
22 | . nop \h'\\n[pca:this-indent]u'
23 | . nop \\*[pca:toc-create-link \\n[pca:toc-snippet-count]]
24 | . br
25 | ..
26 | .
27 | .mso pca-t2p-toc-\*[pca-eval-lang].tmac
28 |
--------------------------------------------------------------------------------
/tmac/pca-eval-lua.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-12
2 | .
3 | .ds pca:eval-file \\*[AUXF].lua
4 | .
5 | .de pca:eval-process-snippets
6 | . sy if test -f \\*[pca:eval-file]; then lua \\*[pca:eval-file]; fi
7 | ..
8 | .
9 | .de pca:eval-start-snippets
10 | . write pca:eval-stream local troff
11 | .
12 | . write pca:eval-stream function pca_eval_lua_preamble(f)
13 | . write pca:eval-stream troff = io.open(f, 'w')
14 | . write pca:eval-stream end
15 | .
16 | . write pca:eval-stream function pca_eval_lua_postamble()
17 | . write pca:eval-stream troff:write('\\\\\\\\c\\\\n')
18 | . write pca:eval-stream troff:write('.ds pca:eval-status done\\\\n')
19 | . write pca:eval-stream troff:close()
20 | . write pca:eval-stream end
21 | ..
22 | .
23 | .de pca:eval-write-snippet
24 | . write pca:eval-stream pca_eval_lua_preamble('\\*[AUXF]-eval-\\n[pca:eval-count].tmp');
25 | . eo
26 | . writem pca:eval-stream pca:eval-text
27 | . ec
28 | . write pca:eval-stream pca_eval_lua_postamble()
29 | ..
30 | .
31 | .if \n[.troff2page] .mso pca-t2p-eval-lua.tmac
32 |
--------------------------------------------------------------------------------
/tmac/pca-eval-js.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-12
2 | .
3 | .ds pca:eval-file \\*[AUXF].js
4 | .
5 | .de pca:eval-process-snippets
6 | . sy if test -f \\*[pca:eval-file]; then nodejs \\*[pca:eval-file]; fi
7 | ..
8 | .
9 | .de pca:eval-start-snippets
10 | . write pca:eval-stream var troff;
11 | . write pca:eval-stream var pca_eval_js_fs = require('fs');
12 | .
13 | . write pca:eval-stream function pca_eval_js_preamble(f) {
14 | . write pca:eval-stream troff = pca_eval_js_fs.createWriteStream(f);
15 | . write pca:eval-stream }
16 | .
17 | . write pca:eval-stream function pca_eval_js_postamble() {
18 | . write pca:eval-stream troff.write('\\\\\\\\c\\\\n');
19 | . write pca:eval-stream troff.write('.ds pca:eval-status done\\\\n');
20 | . write pca:eval-stream troff.end();
21 | . write pca:eval-stream }
22 | ..
23 | .
24 | .de pca:eval-write-snippet
25 | . write pca:eval-stream pca_eval_js_preamble('\\*[AUXF]-eval-\\n[pca:eval-count].tmp');
26 | . writem pca:eval-stream pca:eval-text
27 | . write pca:eval-stream pca_eval_js_postamble();
28 | ..
29 |
--------------------------------------------------------------------------------
/tmac/pca-tag.tmac:
--------------------------------------------------------------------------------
1 | .\" last change 2020-12-12
2 | .\" Dorai Sitaram
3 | .
4 | .\" Generalization of .TAG in groff's www.tmac, in order
5 | .\" to allow forward references
6 | .
7 | .\" troff2page already has it
8 | .if \n[.troff2page] .nx
9 | .
10 | .\" don't load more than once
11 | .if d pca:tag-set-up .nx
12 | .
13 | .if '\*[AUXF]'' .ds AUXF .trofftemp
14 | .
15 | .nr pca:tag-already-set-up 0
16 | .
17 | .ie \n[.U] \{\
18 | . sy test -f \*[AUXF].aux
19 | . if !\n[systat] .so \*[AUXF].aux
20 | . \}
21 | .el .so \*[AUXF].aux
22 | .
23 | .de pca:tag-set-up
24 | . if \\n[pca:tag-already-set-up] .return
25 | . nr pca:tag-already-set-up 1
26 | . if !\\n[.U] .return
27 | . open pca:tag-stream \\*[AUXF].aux
28 | ..
29 | .
30 | .de TAG
31 | . pca:tag-set-up
32 | . \" if 2nd arg present, use that value instead of current pageno
33 | . ie '\\$2'' .ds pca:tag-value \\n[PN]
34 | . el .ds pca:tag-value \\$2
35 | . ds TAG:\\$1 \\*[pca:tag-value]
36 | . \" continue only in unsafe mode
37 | . if !\\n[.U] .return
38 | . write pca:tag-stream .ds TAG:\\$1 \\*[pca:tag-value]
39 | ..
40 |
--------------------------------------------------------------------------------
/tmac/pca-t2p-toc-lua.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2021-11-07
2 | .\" Dorai Sitaram
3 | .
4 | .if !\n[.troff2page] .nx
5 | .
6 | .de pca:toc-hook
7 | .ig ##
8 | do
9 | local f = String_table['AUXF']() .. '.toc'
10 | if not probe_file(f) then flag_missing_piece 'toc' end
11 | if Last_page_number>0 and not Node_table['TAG:__troff2page_toc'] then
12 | flag_missing_piece 'toc-in-nav-bar'
13 | end
14 | end
15 | .##
16 | .TAG __troff2page_toc
17 | ..
18 | .
19 | .ig ##
20 | defstring('pca:toc-create-link', function(n)
21 | local f = String_table['AUXF']() .. '-snippet-' .. n .. '.tmp'
22 | local secnum = String_table['pca:sec-num']()
23 | local o = make_string_output_stream()
24 | --print('pca:toc-create-link reading', f)
25 | with_open_input_file(f, function(i)
26 | if secnum ~= '' then
27 | o:write(secnum, '\n')
28 | end
29 | while true do
30 | local x = i:read '*line'
31 | if not x then break end
32 | o:write(x, '\n')
33 | end
34 | end)
35 | return url_to_html('#TAG:__pca_sec_' .. n, o:get_output_stream_string())
36 | end)
37 | .##
38 |
--------------------------------------------------------------------------------
/tmac/pca-t2p-man.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-13
2 | .\" Dorai Sitaram
3 | .
4 | .if !\n[.troff2page] .nx
5 | .
6 | .if d pca:man-write-toc-line .nx
7 | .
8 | .de TH
9 | .de TH disabled
10 | .tm Calling .TH twice in man page
11 | .disabled
12 | .
13 | .TL
14 | \\$1
15 | .RT
16 | .ND "\\$3
17 | .TAG __troff2page_toc
18 | .so \\*[AUXF].toc
19 | .nr pca:man-enable-toc-entries 1
20 | ..
21 | .
22 | .de TOCLINE-PLAIN
23 | .nr pca:man-sec-count \\$1
24 | .shift
25 | .nr pca:man-tocentry-level \\$1
26 | .shift
27 | \h'\\n[pca:man-tocentry-level]m'
28 | \\*[url #TAG:__pca_sec_\\n[pca:man-sec-count] "\\$*"]
29 | .br
30 | ..
31 | .
32 | .de pca:man-write-toc-line
33 | .if !\\n[pca:man-enable-toc-entries] .return
34 | .if !\\n[pca:man-toc-opened-p] \{\
35 | .nr pca:man-toc-opened-p 1
36 | .open pca:toc-stream \\*[AUXF].toc
37 | .\}
38 | .nr pca:toc-count +1
39 | .TAG __pca_sec_\\n[pca:toc-count]
40 | .write pca:toc-stream .TOCLINE-PLAIN \\n[pca:toc-count] \\$*
41 | ..
42 | .
43 | .de SH
44 | .pca:man-write-toc-line 0 \\$*
45 | .pca:man-orig-SH \\$*
46 | ..
47 | .
48 | .de SS
49 | .pca:man-write-toc-line 1 \\$*
50 | .pca:man-orig-SS \\$*
51 | ..
52 | .
53 | .mso pca-t2p-man-\*[pca-eval-lang].tmac
54 |
--------------------------------------------------------------------------------
/tmac/pca-t2p-man-lua.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-13
2 | .
3 | .ig ##
4 | defrequest('pca:man-orig-SH', function()
5 | emit_section_header(1, {man_header_p=true})
6 | end)
7 |
8 | defrequest('pca:man-orig-SS', function()
9 | emit_section_header(2, {man_header_p=true})
10 | end)
11 |
12 | defrequest('EX', function()
13 | --print('doing EX')
14 | --read_troff_line()
15 | start_display 'L'
16 | emit(switch_font 'C')
17 | --Turn_off_escape_char_p = true
18 | end)
19 |
20 | defrequest('EE', function()
21 | --print('doing EE')
22 | --read_troff_line()
23 | Escape_char = '\\'
24 | --Turn_off_escape_char_p = false
25 | stop_display()
26 | end)
27 |
28 | nb_macro_package('man')
29 |
30 | if Last_page_number>0 and not Node_table['TAG:__troff2page_toc'] then
31 | flag_missing_piece 'toc'
32 | end
33 |
34 | local it = find_macro_file 'man.local'
35 | if it then troff2page_file(it) end
36 |
37 | function call_redefined_TH(args)
38 | local it = Macro_table.TH
39 | defrequest('TH', nil)
40 | if not it then
41 | print('Couldn\'t find .TH', table.unpack(args))
42 | return
43 | end
44 | table.insert(args, 1, 'TH')
45 | flet({Macro_args = args}, function()
46 | execute_macro_body(it)
47 | end)
48 | end
49 |
50 | .##
51 |
--------------------------------------------------------------------------------
/tmac/pca-img.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-13
2 | .\" Dorai Sitaram
3 | .
4 | .if \n[.troff2page] .nx
5 | .
6 | .de IMG
7 | . ds pca:image-align -C\"
8 | . ie '\\$1'-R' \{\
9 | . ds pca:image-align -R\"
10 | . shift
11 | . \}
12 | . el \{\
13 | . if '\\$1'-L' \{\
14 | . ds pca:image-align -L\"
15 | . shift
16 | . \}
17 | . \}
18 | . if '\\$1'-C' .shift
19 | .
20 | . ds pca:image-file \\$1\"
21 | . shift
22 | .
23 | . ie '\\$1'' .nr pca:image-width 1i
24 | . el .nr pca:image-width \\$1
25 | .
26 | . nr pca:image-count +1
27 | . ds pca:image-unique-name .troff_image-\\n[pca:image-count]\"
28 | .
29 | . if \\n[.U] \{\
30 | . ds pca:image-file-ext \\*[pca:image-file]
31 | . substring pca:image-file-ext -4
32 | . ie '\\*[pca:image-file-ext]'.svg' .sy inkscape \\*[pca:image-file] -o \\*[pca:image-unique-name].eps
33 | . el .ie '\\*[pca:image-file-ext]'.png' \{\
34 | . sy convert \\*[pca:image-file] \\*[pca:image-unique-name].bmp
35 | . sy mkbitmap \\*[pca:image-unique-name].bmp -o \\*[pca:image-unique-name].pgm
36 | . sy potrace \\*[pca:image-unique-name].pgm -e -o \\*[pca:image-unique-name].eps
37 | . \}
38 | . el .ie '\\*[pca:image-file-ext]'.jpg' \{\
39 | . sy convert \\*[pca:image-file] \\*[pca:image-unique-name].bmp
40 | . sy mkbitmap \\*[pca:image-unique-name].bmp -o \\*[pca:image-unique-name].pgm
41 | . sy potrace \\*[pca:image-unique-name].pgm -e -o \\*[pca:image-unique-name].eps
42 | . \}
43 | . el .sy convert \\*[pca:image-file] \\*[pca:image-unique-name].eps
44 | . \}
45 | .
46 | . in 0
47 | . PSPIC \\*[pca:image-align] \\*[pca:image-unique-name].eps \\n[pca:image-width]u
48 | ..
49 |
--------------------------------------------------------------------------------
/tmac/pca-eval-lisp.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-12
2 | .
3 | .ds pca:eval-file \\*[AUXF].lisp
4 | .
5 | .de pca:eval-process-snippets
6 | . \" change this to suit your Common Lisp implementation
7 | . sy touch \\*[pca:eval-file]
8 | . sy if test ! -f \\*[pca:eval-file]; then :; \
9 | elif test "$LISP" = abcl; then abcl --batch --noinform --load \\*[pca:eval-file]; \
10 | elif test "$LISP" = allegro; then alisp -L \\*[pca:eval-file] -kill; \
11 | elif test "$LISP" = clisp; then clisp -q \\*[pca:eval-file]; \
12 | elif test "$LISP" = clozure; then ccl -l \\*[pca:eval-file] -e '(ccl:quit)'; \
13 | elif test "$LISP" = cmucl; then lisp -quiet -load \\*[pca:eval-file] -eval '(ext:quit)'; \
14 | elif test "$LISP" = ecl; then ecl -shell \\*[pca:eval-file]; \
15 | elif test "$LISP" = gcl; then gcl -load \\*[pca:eval-file] -eval '(sys:quit)'; \
16 | else sbcl --script \\*[pca:eval-file]; \
17 | fi
18 | ..
19 | .
20 | .de pca:eval-start-snippets
21 | . write pca:eval-stream (defvar *pca-eval-lisp-stdout* *standard-output*)
22 | . write pca:eval-stream (defvar *troff*)
23 | .
24 | . write pca:eval-stream (defun pca-eval-lisp-preamble (f)
25 | . write pca:eval-stream (setq *troff*
26 | . write pca:eval-stream (open f :direction :output :if-exists :supersede)))
27 | .
28 | . write pca:eval-stream (defun pca-eval-lisp-postamble ()
29 | . write pca:eval-stream (format t "\\\\\\\\c~%")
30 | . write pca:eval-stream (format t ".ds pca:eval-status done~%")
31 | . write pca:eval-stream (close *troff*))
32 | ..
33 | .
34 | .de pca:eval-write-snippet
35 | . write pca:eval-stream (pca-eval-lisp-preamble "\\*[AUXF]-eval-\\n[pca:eval-count].tmp")
36 | . eo
37 | . writem pca:eval-stream pca:eval-text
38 | . ec
39 | . write pca:eval-stream (pca-eval-lisp-postamble)
40 | ..
41 | .
42 | .if \n[.troff2page] .mso pca-t2p-eval-lisp.tmac
43 |
--------------------------------------------------------------------------------
/tmac/pca-eval.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-12
2 | .\" Dorai Sitaram
3 | .
4 | .\" don't load more than once
5 | .
6 | .if d pca:eval-process-snippets .nx
7 | .
8 | .if '\*[AUXF]'' .ds AUXF .trofftemp
9 | .
10 | .\" if pca-eval-lang is neither js, lisp, or lua, assume lua
11 | .
12 | .ie '\*[pca-eval-lang]'' .ds pca-eval-lang lua
13 | .el .ie '\*[pca-eval-lang]'js' .\"
14 | .el .ie '\*[pca-eval-lang]'lisp' .\"
15 | .el .ie '\*[pca-eval-lang]'lua' .\"
16 | .el .ds pca-eval-lang lua
17 | .
18 | .nr pca:eval-already-set-up 0
19 | .
20 | .de pca:eval-set-up
21 | . if \\n[pca:eval-already-set-up] .return
22 | . nr pca:eval-already-set-up 1
23 | . nr pca:eval-count 0
24 | . if !\\n[.U] .return
25 | . pca:eval-process-snippets
26 | . open pca:eval-stream \\*[pca:eval-file]
27 | . pca:eval-start-snippets
28 | ..
29 | .
30 | .ds pca:eval-status try
31 | .
32 | .de eval
33 | . eo
34 | . de pca:eval-text endeval
35 | ..
36 | .
37 | .de endeval
38 | . ec
39 | . pca:eval-so-snippet
40 | . if !\\n[.U] .return
41 | . pca:eval-write-snippet
42 | ..
43 | .\" is empty line needed at last line of .endeval?
44 | .
45 | .de pca:eval-rerun-needed
46 | . ds pca:eval-status rerun
47 | . if !\\n[.troff2page] .tm Rerun groff with -U
48 | ..
49 | .
50 | .de pca:eval-load-snippet-if-poss
51 | . nr pca:eval-systat 0
52 | . if \\n[.U] \{\
53 | . sy test -f \\*[pca:eval-snippet-file]
54 | . nr pca:eval-systat \\n[systat]
55 | . \}
56 | . if !\\n[pca:eval-systat] \{\
57 | . so \\*[pca:eval-snippet-file]
58 | . if '\\*[pca:eval-status]'done' .return
59 | . \}
60 | . pca:eval-rerun-needed
61 | ..
62 | .
63 | .de pca:eval-so-snippet
64 | . pca:eval-set-up
65 | . nr pca:eval-count +1
66 | . ds pca:eval-snippet-file \\*[AUXF]-eval-\\n[pca:eval-count].tmp
67 | . if !'\\*[pca:eval-status]'rerun' \{\
68 | . pca:eval-load-snippet-if-poss
69 | . \}
70 | . if '\\*[pca:eval-status]'rerun' \[rh]eval\[lh]
71 | ..
72 | .
73 | .mso pca-eval-\*[pca-eval-lang].tmac
74 |
--------------------------------------------------------------------------------
/tmac/pca-t2p-ix-lua.tmac:
--------------------------------------------------------------------------------
1 | .\" last change 2020-12-13
2 | .\" Dorai Sitaram
3 | .
4 | .de pca:call-makeindex-pre-hook
5 | . ig ##
6 | do
7 | local f = String_table.AUXF() .. '.ind'
8 | local create_bogus_ind_file_p = false
9 | if not probe_file(f) then
10 | do end
11 | elseif Source_changed_since_last_time_p and file_write_date(f) < Last_modification_time then
12 | flag_missing_piece 'index'
13 | os.execute('rm '..f)
14 | end
15 | end
16 | . ##
17 | . nr pca:ix-location 0
18 | ..
19 | .
20 | .de pca:call-makeindex-post-hook
21 | . ig ##
22 | do
23 | local f = String_table.AUXF()..'.ind'
24 | if not probe_file(f) then
25 | with_open_output_file(f, function(o)
26 | o:write('.TAG __troff2page_index\\n')
27 | o:write('.pca:cant-open-ind-file\\n')
28 | end)
29 | end
30 | end
31 | . ##
32 | ..
33 | .
34 | .de pca:cant-open-ind-file
35 | . ig ##
36 | flag_missing_piece 'index'
37 | do
38 | local f = String_table.AUXF() .. '.ind'
39 | File_postlude = function()
40 | os.remove(f)
41 | twarning("can't open %s: No such file or directory", f)
42 | end
43 | end
44 | . ##
45 | ..
46 | .
47 | .am pca:ix-item0
48 | .ig ##
49 | Pca_t2p_ix_pageno_mention_table = {}
50 | .##
51 | ..
52 | .
53 | .am pca:ix-item1
54 | .ig ##
55 | Pca_t2p_ix_pageno_mention_table = {}
56 | .##
57 | ..
58 | .
59 | .am pca:ix-item2
60 | .ig ##
61 | Pca_t2p_ix_pageno_mention_table = {}
62 | .##
63 | ..
64 | .
65 | .de pca:ix-hook
66 | .ig ##
67 | if Last_page_number>0 and not Node_table['TAG:__troff2page_index'] then
68 | flag_missing_piece 'index-in-nav-bar'
69 | end
70 | .##
71 | .TAG __troff2page_index
72 | ..
73 | .
74 | .ig ##
75 | Pca_t2p_ix_pageno_mention_table = {}
76 |
77 | defstring('pca:ix-function', function(ixno)
78 | local ix_tag = 'TAG:__troff2page_index_' .. ixno
79 | local ix_pageno = Node_table[ix_tag]
80 | local res = link_start(page_node_link(ix_pageno, ix_tag), true) ..
81 | verbatim(ix_pageno)
82 | local n = Pca_t2p_ix_pageno_mention_table[ix_pageno]
83 | if n then
84 | res = res .. ':'
85 | n = n+1
86 | Pca_t2p_ix_pageno_mention_table[ix_pageno] = n
87 | res = res .. toroman(n, true)
88 | else
89 | Pca_t2p_ix_pageno_mention_table[ix_pageno] = 1
90 | end
91 | res = res .. link_stop()
92 | return res
93 | end)
94 | .##
95 |
--------------------------------------------------------------------------------
/tmac/pca-toc.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2021-11-14
2 | .\" Dorai Sitaram
3 | .
4 | .if d pca:section-postlude .nx
5 | .
6 | .if '\*[AUXF]'' .ds AUXF .trofftemp
7 | .
8 | .de ToC
9 | . nr pca:DI \\n(DI
10 | . if !\\n[pca:DI] .nr pca:DI 1.5m
11 | . if !\n[.troff2page] .nr pca:DI \\n[pca:DI]/2u
12 | . if d pca:toc-hook .pca:toc-hook
13 | . so \\*[AUXF].toc
14 | . nr pca:sec-triggers-tocentry-p 1
15 | . if !\\n[pca:toc-stream-open-p] \{\
16 | . nr pca:toc-stream-open-p 1
17 | . open pca:toc-stream \\*[AUXF].toc
18 | . \}
19 | ..
20 | .
21 | .if !\n[.U] .nx
22 | .
23 | .de pca:sec-with-tocentry
24 | . nr pca:inside-section-p 0
25 | . nr pca:toc-header-level \\n[nh*hl]
26 | . nr pca:create-tocentry 1
27 | . ie !\\n[pca:sec-triggers-tocentry-p] .nr pca:create-tocentry 0
28 | . el .if (\\n[pca:toc-header-level] > \\n[GROWPS]) .nr pca:create-tocentry 0
29 | . if \\n[pca:create-tocentry] \{\
30 | . nr pca:inside-section-p 1
31 | . nr pca:toc-count +1
32 | . di pca:toc-header-text
33 | . \}
34 | ..
35 | .
36 | .rn @SH pca:toc-orig-@SH
37 | .rn @NH pca:toc-orig-@NH
38 | .
39 | .de @SH
40 | . ds SN-STYLE \"
41 | . pca:toc-orig-@SH \\$*
42 | . ie '\\$1'' .nr nh*hl \\n[GROWPS]
43 | . el .nr nh*hl \\$1
44 | . pca:sec-with-tocentry
45 | ..
46 | .
47 | .de @NH
48 | . pca:toc-orig-@NH \\$*
49 | . pca:sec-with-tocentry
50 | ..
51 | .
52 | .als SH @SH
53 | .als NH @NH
54 | .
55 | .de pca:write-toc-line
56 | . nr pca:this-indent \\n[pca:DI]u
57 | . nr pca:this-indent (\\n[pca:this-indent]*\\n[pca:toc-header-level])
58 | . write pca:toc-stream .IP "" \\n[pca:this-indent]u
59 | . write pca:toc-stream \\*[pca:toc-header-text]
60 | . write pca:toc-stream \\&... \\n[%]
61 | ..
62 | .
63 | .de pca:section-postlude
64 | . nr pca:inside-section-p 0
65 | . if !\n[.troff2page] .br
66 | . di
67 | . asciify pca:toc-header-text
68 | . chop pca:toc-header-text
69 | . if \n[.troff2page] \{\
70 | . open pca:toc-snippet-stream \\*[AUXF]-snippet-\\n[pca:toc-count].tmp
71 | . write pca:toc-snippet-stream \\*[pca:toc-header-text]
72 | . close pca:toc-snippet-stream
73 | . \}
74 | . pca:write-toc-line
75 | . if d TAG .TAG __pca_sec_\\n[pca:toc-count]
76 | . ie \n[.troff2page] .so \\*[AUXF]-snippet-\\n[pca:toc-count].tmp
77 | . el .nop \\*[pca:toc-header-text]
78 | ..
79 | .
80 | .am ds@auto-end
81 | . if \\n[pca:inside-section-p] .pca:section-postlude
82 | ..
83 | .
84 | .if \n[.troff2page] .mso pca-t2p-toc.tmac
85 |
--------------------------------------------------------------------------------
/tmac/pca-ix.tmac:
--------------------------------------------------------------------------------
1 | .\" last modified 2020-12-12
2 | .\" Dorai Sitaram
3 | .
4 | .\" disable for nroff
5 | .if n .nx
6 | .
7 | .\" don't source more than once
8 | .if d pca:set-up-index .nx
9 | .
10 | .if '\*[AUXF]'' .ds AUXF .trofftemp
11 | .
12 | .\" Index
13 | .
14 | .nr pca:index-already-set-up 0
15 | .
16 | .de pca:ix-item0
17 | . in 0i
18 | ..
19 | .
20 | .de pca:ix-item1
21 | . in .25i
22 | ..
23 | .
24 | .de pca:ix-item2
25 | . in .5i
26 | ..
27 | .
28 | .de pca:call-makeindex
29 | . \" calls makeindex if .idx is present and .ind isn't
30 | . sy if test -f \\*[AUXF].idx; then mv \\*[AUXF].idx z\\*[AUXF].idx; fi
31 | . sy if test -f z\\*[AUXF].idx -a ! -f \\*[AUXF].ind; then makeindex -s \\*[AUXF].mst -r z\\*[AUXF].idx; fi
32 | . sy if test -f z\\*[AUXF].ind; then mv z\\*[AUXF].ind \\*[AUXF].ind; fi
33 | . sy rm -f z\\*[AUXF].idx z\\*[AUXF].ilg
34 | ..
35 | .
36 | .de pca:make-mst-file
37 | . open pca:mst-stream \\*[AUXF].mst
38 | . write pca:mst-stream preamble ".
39 | . write pca:mst-stream .if n .nx
40 | . write pca:mst-stream .if d pca:ix-hook .pca:ix-hook
41 | . write pca:mst-stream .de see
42 | . \" in the following
43 | . \" 8 \s in .de body
44 | . \" 4 \s when .write is called
45 | . \" 2 \s in the string written to
46 | . \" 1 \s when the string is unslashed
47 | . \" so use 4 \s when you want a character like newline
48 | . \" otherwise use 8 times the required nr of \s
49 | . write pca:mst-stream \\\\\\\\fIsee\\\\\\\\fR \\\\\\\\\\\\\\\\$1
50 | . write pca:mst-stream ..
51 | . write pca:mst-stream .de seealso
52 | . write pca:mst-stream \\\\\\\\fIsee also\\\\\\\\fR \\\\\\\\\\\\\\\\$1
53 | . write pca:mst-stream .."
54 | . \"write pca:mst-stream .ns"
55 | . write pca:mst-stream postamble "\\\\n"
56 | . write pca:mst-stream group_skip "\\\\n.sp .5v"
57 | . write pca:mst-stream item_0 "\\\\n.pca:ix-item0\\\\n\\\\\\\\&"
58 | . write pca:mst-stream item_1 "\\\\n.pca:ix-item1\\\\n\\\\\\\\&"
59 | . write pca:mst-stream item_01 "\\\\n.pca:ix-item1\\\\n\\\\\\\\&"
60 | . write pca:mst-stream item_x1 "\\\\n.pca:ix-item1\\\\n\\\\\\\\&"
61 | . write pca:mst-stream item_2 "\\\\n.pca:ix-item2\\\\n\\\\\\\\&"
62 | . write pca:mst-stream item_12 "\\\\n.pca:ix-item2\\\\n\\\\\\\\&"
63 | . write pca:mst-stream item_x2 "\\\\n.pca:ix-item2\\\\n\\\\\\\\&"
64 | . write pca:mst-stream delim_r "-"
65 | . write pca:mst-stream indent_space ""
66 | . write pca:mst-stream encap_prefix "\\\\\\\\*["
67 | . write pca:mst-stream encap_infix " "
68 | . write pca:mst-stream encap_suffix "]"
69 | . close pca:mst-stream
70 | ..
71 | .
72 | .de pca:set-up-index
73 | . if \\n[pca:index-already-set-up] .return
74 | . nr pca:index-already-set-up 1
75 | . if d pca:call-makeindex-pre-hook .pca:call-makeindex-pre-hook
76 | . pca:call-makeindex
77 | . if d pca:call-makeindex-post-hook .pca:call-makeindex-post-hook
78 | . pca:make-mst-file
79 | . open pca:idx-stream \\*[AUXF].idx
80 | ..
81 | .
82 | .de IX
83 | . if !\\n[.U] .return
84 | . pca:set-up-index
85 | . write pca:idx-stream \\\\indexentry{\\$*}{\\n[%]}
86 | ..
87 | .
88 | .de INDX
89 | . so \\*[AUXF].ind
90 | ..
91 | .
92 | .if \n[.troff2page] .mso pca-t2p-ix.tmac
93 |
--------------------------------------------------------------------------------
/bin/adoc2ms:
--------------------------------------------------------------------------------
1 | # convert .adoc to .ms
2 | # Dorai Sitaram
3 | # last modified 2021-11-14
4 | # created < 2016-02-11
5 |
6 | f=
7 |
8 | if test $# -ne 1; then
9 | echo adoc2ms needs exactly one arg
10 | exit 1
11 | else
12 | f=$1
13 | fi
14 |
15 | f_dir=${f%/*}
16 |
17 | if test "$f_dir" = "$f"; then
18 | f_dir=""
19 | else
20 | f_dir=$f_dir/
21 | fi
22 |
23 | f_without_dir=${f##*/}
24 |
25 | f_basename=${f_without_dir%.*}
26 |
27 | f_dir_basename=$f_dir$f_basename
28 |
29 | asciidoctor $f
30 |
31 | cp $f_dir_basename.html $f_dir.dbg.html
32 |
33 | sed -i \
34 | -e 's//%ImageForGroff% \1 \2/' \
35 | $f_dir_basename.html
36 |
37 | sed -i \
38 | -e 's/^