|
Subject: Re: HyperFred: how to make links in Fred? Invisible chars? Newsgroups: gmane.lisp.mcl.general Date: 2003-05-22 17:22:01 GMT (6 years, 6 weeks, 1 day, 19 hours and 39 minutes ago)
Hi, perhaps you get some ideas of how I solved Symbolic Composer documentation
problem. The problem was that I was having thousand documents having
text and lisp code, and my aim is to make them look good with the minimum
amount of manual formating.
I ended up parsing the document to chunks, where the parser recognize text
and lisp, and levels of comments, and then installs corresponding objects to a
view. For example ;; makes a header, ;;;makes a bigger header and so
on. Parsing
occurs when the document is opened.
While parsing, inline directive executes Lisp as progn, and allows to draw
simple graphs and show jpegs based on Alexander Repenning's jpeg code. It
also shows the Lisp parse trees. Also basic buttons and interface items are
supported by the inline directive.
Link underlining is done just before the document is shown, and all
current hyperwords
are underlined. View double-click method checks if the current sexpression is
a hyperword and passes call to a document opener function with the
current sexpression
as an argument, which proceeds checking if it is a Symbolic Composer document
or a html link, or a MIDI file, or an application, or another
application document.
Full html parser would be the most flexible, but requires much extra formating
and maintenance when documents are later edited, or function names
(hyperword links)
are changed, that I found this quick and dirty method do things automatically.
There are some drawbacks, too. The hyperdocs cannot be edited in the view-mode,
which would be nice but requires a full new fred concept.
BTW, Alice helped me to solve MCL5 porting issues that I complained
earlier to this
group. Now when I have the port finished I would say that MCL5 final
is cool, and suggest it to everybody!
Pekka
Here is the SCOM hyperdocument source code:
gen-sin frequency amplitude samples &optional phase modulation
Returns a vector, whose length is determined by samples of a sine
wave having given frequency and amplitude and optional phase and
modulation. If omitted a zero phase is used. The modulation is a
vector pattern returned by another generator. The phase values range
from 0 to 360.
(vector-round 0 127 (gen-sin 1 0.5 64))
--> #(64 70 76 82 88 93 99 104 108 113 116 120 122 124 126 127 127
127 126 124 122 120 116 113 108 104 99 93 88 82 76 70 64 57 51 45 39
34 28 23 19 14 11 7 5 3 1 0 0 0 1 3 5 7 11 14 19 23 28 34 39 45 51 57)
;;How does it look like?
(inline (progn (make-graph 'draw-vector-x (do-quietly (vector-round 0
127 (gen-sin 1 0.5 64))))))
;;Adjusting Phase
(vector-round 0 127 (gen-sin 1 0.5 64 90))
(inline (progn (make-graph 'draw-vector-x (do-quietly (vector-round 0
127 (gen-sin 1 0.5 64 90))))))
;;Adjusting Samples and Scaling with vector-round
(vector-round 0 65 (gen-sin 1 0.5 128 90 (gen-sin 1 0.3 128)))
(inline (progn (make-graph 'draw-vector-x (do-quietly (vector-round 0
65 (gen-sin 1 0.5 128 90 (gen-sin 1 0.3 128)))))))
;;Modulation Examples
(vector-round 0 127 (gen-sin 1 0.5 256 90 (gen-sin 2 0.3 256 0
(gen-sin 3 0.3 256))))
(inline (progn (make-graph 'draw-vector-x (do-quietly (vector-round 0
127 (gen-sin 1 0.5 256 90 (gen-sin 2 0.3 256 0 (gen-sin 3 0.3
256))))))))
(vector-round 0 25 (gen-sin 1 0.5 256 90 (gen-sin 2 0.3 256 0
(gen-sin 3 0.3 256))))
(inline
(progn
(make-graph 'draw-vector-x
(do-quietly
(vector-round 0 54
(gen-sin 1 0.5 512 90
(gen-sin 2 0.3 512 0
(gen-sin 3 0.3 512))))))))
This shows how the source above looks like when rendered.
|
|
|