File: make-docs

package info (click to toggle)
scheme9 2025.08.12-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,080 kB
  • sloc: lisp: 16,752; ansic: 11,869; sh: 806; makefile: 237; sed: 6
file content (104 lines) | stat: -rw-r--r-- 2,223 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/sh

tmp=/tmp/make-doc.tmp.$$
tmp2=/tmp/make-doc.tmp2.$$
sigs=/tmp/make-doc.sigs.$$
prose=/tmp/make-doc.prose.$$
exms=/tmp/make-doc.exms.$$

cleanup() {
	rm -f $tmp $tmp2 $sigs $prose $exms
}

trap cleanup 1 2 3

format() {
	sed -e '1,/^;$/d' <$1 >$tmp
	sed -ne '1,/^;$/p' <$tmp | sed -e 's/^; //' -e '$d' >$sigs
	sed -e '1,/^;$/d' \
	    -e 's/; (load-from-library/;         (load-from-library/' \
	    <$tmp >$tmp2 && mv -f $tmp2 $tmp

	if grep '^; Given: ' $tmp >/dev/null; then
		sed -ne '1,/^;.*Given:   /p' <$tmp | \
			sed -e 's/^; //' -e 's/^;$//' -e '$d' >$prose

		sed -ne '/^;.*Given:   /,/^$/p' <$tmp | sed -e '$d' | \
			sed -e 's/^;$//' | \
			sed -e 's/^.............//' >$exms
	else
		sed -ne '1,/^;.*Example)*:/p' <$tmp | \
			sed -e 's/^; //' -e 's/^;$//' -e '$d' >$prose

		sed -ne '/^;.*Example)*:/,/^$/p' <$tmp | sed -e '$d' | \
			sed -e 's/^;$//' | \
			sed -e 's/^.............//' >$exms
	fi

	sed -e '1s/^/S9 LIB  /' -e '2,$s/^/        /' <$sigs
	echo
	cat $prose
	cat $exms
}

if [ ! -d help-new ]; then
	mkdir help-new
	mkdir help-new/sys-unix
	mkdir help-new/curses
	mkdir help-new/csv
fi

for file in lib/*.scm contrib/*.scm; do
	if echo $file | grep -- '-test.scm' >/dev/null 2>&1; then
		continue
	fi
	format $file >help-new/$(basename $file .scm)
	echo $file
done

for ext in sys-unix curses csv; do
	for file in ext/$ext/*.scm; do
		format $file >help-new/$ext/$(basename $file .scm)
		echo $file
	done
done

cd help-new

rm -f	csv/csv		\
	curses/curses	\
	fluid-let-sr	\
	format		\
	io-tools	\
	list-tools	\
	math-tools	\
	set-tools	\
	string-tools	\
	syntax-rules	\
	sys-unix/unix	\
	unix-tools	\
	vector-tools

mv -f amk runstar
mv -f array make-array
mv -f bitops bit0
mv -f bitwise-ops bitwise-and
mv -f char-canvas make-canvas
mv -f hof complement
mv -f hash-table make-hash-table
mv -f letcc letslashcc
mv -f matcher define-matcher
mv -f setters pushb
mv -f rb-tree make-rbt
mv -f records record
mv -f regex re-comp
mv -f simple-modules module
mv -f s9sos define-class
mv -f sys-unix/standard-error sys-unix/standard-error-port
mv -f streams make-stream
mv -f string-case string-upcase
mv -f symbols r4rs-procedures
mv -f threads thread-create
mv -f time-ops time-add

cleanup