summaryrefslogtreecommitdiffstats
path: root/mklibcat.scm
blob: d6bd3803fcec18ec4d52e8ce92340f834f65662a (plain)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
;"mklibcat.scm" Build catalog for SLIB
;Copyright (C) 1997 Aubrey Jaffer
;
;Permission to copy this software, to redistribute it, and to use it
;for any purpose is granted, subject to the following restrictions and
;understandings.
;
;1.  Any copy made of this software must include this copyright notice
;in full.
;
;2.  I have made no warrantee or representation that the operation of
;this software will be error-free, and I am under no obligation to
;provide any services, by way of maintenance, update, or otherwise.
;
;3.  In conjunction with products arising from the use of this
;material, there shall be no use of my name in any advertising,
;promotional, or sales literature without prior written consent in
;each case.

(call-with-output-file (in-vicinity (implementation-vicinity) "slibcat")
  (lambda (op)
    (display ";\"slibcat\" SLIB catalog for " op)
    (display (scheme-implementation-type) op)
    (display (scheme-implementation-version) op)
    (display ".        -*-scheme-*-" op) (newline op)
    (display ";" op) (newline op)
    (display "; DO NOT EDIT THIS FILE -- it is automagically generated" op)
    (newline op) (newline op)

    (display "(" op) (newline op)
    (for-each
     (lambda (asp) (display " " op) (write asp op) (newline op))
     (append
      (list (cons 'schelog
		  (in-vicinity (sub-vicinity (library-vicinity) "schelog")
			       "schelog"))
	    (cons 'portable-scheme-debugger
		  (in-vicinity (sub-vicinity (library-vicinity) "psd")
			       "psd-slib")))
      (map (lambda (p)
	     (if (symbol? (cdr p)) p
		 (cons
		  (car p)
		  (if (pair? (cdr p))
		      (cons
		       (cadr p)
		       (in-vicinity (library-vicinity) (cddr p)))
		      (in-vicinity (library-vicinity) (cdr p))))))
	   '(
	     (rev4-optional-procedures	.	"sc4opt")
	     (rev2-procedures		.	"sc2")
	     (multiarg/and-		.	"mularg")
	     (multiarg-apply		.	"mulapply")
	     (rationalize		.	"ratize")
	     (transcript		.	"trnscrpt")
	     (with-file			.	"withfile")
	     (dynamic-wind		.	"dynwind")
	     (dynamic			.	"dynamic")
	     (fluid-let		defmacro	.	"fluidlet")
	     (alist			.	"alist")
	     (hash			.	"hash")
	     (sierpinski		.	"sierpinski")
	     (soundex			.	"soundex")
	     (hash-table		.	"hashtab")
	     (logical			.	"logical")
	     (random			.	"random")
	     (random-inexact		.	"randinex")
	     (modular			.	"modular")
	     (factor			.	"factor")
	     (primes			.	factor)
	     (charplot			.	"charplot")
	     (sort			.	"sort")
	     (tsort			.	topological-sort)
	     (topological-sort		.	"tsort")
	     (common-list-functions	.	"comlist")
	     (tree			.	"tree")
	     (format			.	"format")
	     (generic-write		.	"genwrite")
	     (pretty-print		.	"pp")
	     (pprint-file		.	"ppfile")
	     (object->string		.	"obj2str")
	     (string-case		.	"strcase")
	     (stdio			.	"stdio")
	     (printf			.	"printf")
	     (scanf			.	"scanf")
	     (line-i/o			.	"lineio")
	     (string-port		.	"strport")
	     (getopt			.	"getopt")
	     (debug			.	"debug")
	     (qp			.	"qp")
	     (break	defmacro	.	"break")
	     (trace	defmacro	.	"trace")
	     (eval			.	"eval")
	     (record			.	"record")
	     (promise			.	"promise")
	     (synchk			.	"synchk")
	     (defmacroexpand		.	"defmacex")
	     (macro-by-example	defmacro	.	"mbe")
	     (syntax-case		.	"scainit")
	     (syntactic-closures	.	"scmacro")
	     (macros-that-work		.	"macwork")
	     (macro			.	macro-by-example)
	     (object			.	"object")
	     (yasos		macro	.	"yasyn")
	     (oop			.	yasos)
	     (collect		macro	.	"collect")
	     (struct	defmacro	.	"struct")
	     (structure	syntax-case	.	"structure")
	     (values			.	"values")
	     (queue			.	"queue")
	     (priority-queue		.	"priorque")
	     (array			.	"array")
	     (array-for-each		.	"arraymap")
	     (repl			.	"repl")
	     (process			.	"process")
	     (chapter-order		.	"chap")
	     (posix-time		.	"psxtime")
	     (common-lisp-time		.	"cltime")
	     (time-zone			.	"timezone")
	     (relational-database	.	"rdms")
	     (database-utilities	.	"dbutil")
	     (database-browse		.	"dbrowse")
	     (html-form			.	"htmlform")
	     (alist-table		.	"alistab")
	     (parameters		.	"paramlst")
	     (getopt-parameters		.	"getparam")
	     (read-command		.	"comparse")
	     (batch			.	"batch")
	     (glob			.	"glob")
	     (filename			.	glob)
	     (make-crc			.	"makcrc")
	     (fft			.	"fft")
	     (wt-tree			.	"wttree")
	     (string-search		.	"strsrch")
	     (root			.	"root")
	     (precedence-parse		.	"prec")
	     (parse			.	precedence-parse)
	     (commutative-ring		.	"cring")
	     (self-set			.	"selfset")
	     (determinant		.	"determ")
	     (byte			.	"byte")
	     (tzfile			.	"tzfile")
	     (schmooz			.	"schmooz")
	     (net-clients		.	"nclients")
	     (new-catalog		.	"mklibcat")
	     ))))
    (display " " op)

    (let* ((req (in-vicinity (library-vicinity)
			     (string-append "require" (scheme-file-suffix)))))
      (write (cons '*SLIB-VERSION* (or (require:version req) *SLIB-VERSION*))
	     op))
    (newline op)
    (display ")" op) (newline op)

    (let ((load-if-exists
	   (lambda (path)
	     (cond ((not (file-exists? path))
		    (set! path (string-append path (scheme-file-suffix)))))
	     (cond ((file-exists? path)
		    (slib:load-source path))))))
      ;;(load-if-exists (in-vicinity (implementation-vicinity) "mksitcat"))
      (load-if-exists (in-vicinity (implementation-vicinity) "mkimpcat")))

    (let ((catcat
	   (lambda (vicinity name specificity)
	     (let ((path (in-vicinity vicinity name)))
	       (and (file-exists? path)
		    (call-with-input-file path
		      (lambda (ip)
			(newline op)
			(display "; " op)
			(write path op)
			(display " SLIB " op)
			(display specificity op)
			(display "-specific catalog additions" op)
			(newline op) (newline op)
			(do ((c (read-char ip) (read-char ip)))
			    ((eof-object? c))
			  (write-char c op)))))))))
      (catcat (library-vicinity) "sitecat" "site")
      (catcat (implementation-vicinity) "implcat" "implementation")
      (catcat (implementation-vicinity) "sitecat" "site"))
    ))

(set! *catalog* #f)