-
Notifications
You must be signed in to change notification settings - Fork 3
/
help.lisp
162 lines (136 loc) · 6.03 KB
/
help.lisp
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
;;; -*- MODE: LISP; SYNTAX: COMMON-LISP; PACKAGE: *SIM-I; BASE: 10; MUSER: YES; -*-
(in-package :*sim-i)
;;;> *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
;;;>
;;;> The Thinking Machines *Lisp Simulator is in the public domain.
;;;> You are free to do whatever you like with it, including but
;;;> not limited to distributing, modifying, and copying.
;;;>
;;;> *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
;;; Author: JP Massar.
(defparameter *help-string*
"
Release Notes for 5.1 and 5.2 *Lisp exist. They should be added to your
existing 5.0 *Lisp documentation.
New with 5.1 *Lisp is the *Lisp Library,
including routines which do FFT and matrix multiply.
Documentation for the *Lisp library exists at TMC in
/cm/starlisp/library/f5201/documentation.text.
Ask your applications engineer of systems administrator
where this file is at your site.
New with 5.2 *Lisp is *Graphics, a system for easily displaying
pvar data to a CM Framebuffer, and X Window or a Symbolics Screen.
The *Graphics Manual can be found with the Paris documentation
about the CM Framebuffer and the Paris Rendering and Generic
Display facilities.
You can find out some information about most Starlisp symbols by typing
(help 'symbol), e.g., (help '+!!)
Thinking Machines Corporation offers a training course which covers
Starlisp and other aspects of Connection Machine programming.
The source to Starlisp is available on line. On a Symbolics Lisp Machine,
use Meta-. to examine source files. In a Unix environment, ask your
systems administrator or Applications Engineer where the Starlisp source
files were installed. If you have the GMACS editor and TMC's enhancements
to it then you can use Meta-. from within GMACS, along with many other
useful debugging and programming tools.
The *Lisp Simulator, which runs on Machintoshes, Lisp Machines
Unix boxes, VMS and various other platforms that have Common
Lisp available is available from TMC Customer Support.
There are example programs in the directory
/cm/starlisp/interpreter/f5201/ at TMC and/or where the sources
for the Starlisp Simulator are with names that have the text 'example' in them.
Ask your applications engineer or systems manager exactly where
this directory lives at your installation."
)
(defvar *do-not-know-string*
"~%The symbol ~S is not a documented, exported, Starlisp symbol.~
There is no information about it inside Starlisp.~%"
)
(defun find-value-for-keyword (keyword list)
(let ((position (position keyword list :test #'eq)))
(if (null position)
nil
(nth (1+ position) list)
)))
(defun parse-doc-code-string (doc-code-string)
(if (null doc-code-string)
(values nil nil)
(let ((semipos (position #\; doc-code-string)))
(if semipos
(multiple-value-bind (document page)
(parse-single-doc-code-string (subseq doc-code-string 0 semipos))
(multiple-value-bind (documents pages)
(parse-doc-code-string (subseq doc-code-string (1+ semipos)))
(values (cons document documents) (cons page pages))
))
(multiple-value-bind (document page)
(parse-single-doc-code-string doc-code-string)
(values (list document) (list page))
)))))
(defun parse-single-doc-code-string (doc-code-string)
(let* ((document-code-string (subseq doc-code-string 0 2))
(document-code-symbol (intern-in-starlisp-internal-package document-code-string))
(document-text (cadr (assoc document-code-symbol *doc-code-to-english-mapping*)))
)
(if (eql (length doc-code-string) 2)
(values document-text nil)
(if (not (eql #\, (char doc-code-string 2)))
(values document-text nil)
(values document-text (subseq doc-code-string 3))
))))
(defun help (&optional symbol)
(when (not *load-starlisp-interface-info*)
(format t "~%Sorry, Starlisp Help System not loaded. No help available.")
(return-from help nil)
)
(when (stringp symbol) (setq symbol (intern-in-starlisp-package symbol)))
(when (not (symbolp symbol))
(error "Sorry, I can only help you if you give me the name of something. ~A is not a name" symbol)
)
(if (null symbol)
(format t "~%~%~A~%" *help-string*)
(let ((*print-case* :downcase))
(if (null (member symbol *all-external-symbols*))
(format t *do-not-know-string* symbol)
(let ((descriptor (get symbol :starlisp-descriptor)))
(if (or (null descriptor) (not (stringp descriptor)))
(error "Internal error. The symbol ~S in on the *all-external-symbols* list, but has no descriptor"
symbol
)
(let* ((descriptor (read-from-string descriptor))
(type (find-value-for-keyword :type descriptor))
(arglist (find-value-for-keyword :arglist descriptor))
(docptr (find-value-for-keyword :docptr descriptor))
(info (find-value-for-keyword :info descriptor))
)
(when (stringp arglist) (setq arglist (read-from-string arglist nil nil)))
(format t "~%The Starlisp symbol ~A is a ~A." symbol (intern (symbol-name type)))
(when arglist
(format t "~% ~A has an argument list of the form ~S." symbol arglist)
)
(when docptr
(multiple-value-bind (documents pages)
(parse-doc-code-string docptr)
(mapcar
#'(lambda (document page)
(format t "~% Documentation for ~A exists in the ~A" symbol document)
(if page
(format t ", p. ~A." page)
(format t ".")
))
documents
pages
)))
(when info
(map nil
#'(lambda (char)
(let ((english
(cadr (assoc (intern-in-starlisp-internal-package (string char))
*character-to-english-mapping*
))))
(format t "~% The ~A ~A ~A" (intern (symbol-name type)) symbol english)
))
info
))
(terpri)
)))))))