[REBOL] Re: Layout
From: gscottjones:mchsi at: 21-Sep-2002 10:35
From: "Bertrand"
> But simply if you could tell me
> more about the following: <svv: system/view/vid>
Hi, Bertrand,
Some of REBOL itself is written in code that is platform specific, and these
parts are referred to as native. A surprising amount of REBOL is coded in
REBOL. The first level of this code is also called the mezzanine. One can
get at this level through the path word 'system. Warning: it makes calls
itself, and used to lock up when probed with "probe system". The recursion
is limited now for probe, but the code is long, so it is usually more
helpful to look at sections as needed.
>> probe first system
[self version build product components words
license options user script console ports network
schemes error standard view stats locale user-license]
>> probe first system/view
[self screen-face focal-face caret highlight-start
highlight-end title-size resize-border no-resize-border
line-info VID event-port debug pop-face pop-list
wake-event window-feel]
>> probe first system/view/vid
[self verbose warn word-limits vid-feel icon-image
radio.bmp radio-on.bmp vid-colors vid-face
state-flags vid-words vid-styles track error
warning facet-words fw-with fw-feel spot expand-specs
grow-facets do-facets next-tab choice-face set-edge]
So one can work ones way through the path refinements to get to sections of
the source code. svv was assigned to this path to merely keep the code from
wrapping. vid-styles is a block that contains all the vid styles found in
VID. I merely used a select to get to the face template for text.
There are other ways to make faces, and in fact Romano shows another way in
an earlier submission.
TIMTOWTDI There is more than one way to do it" (Thanks, Larry Wall)
There are benefits to some over others, and I don't pretend to be an expert
to know in which situations where one is better than another.
As a final note about the REBOL system, one can get the source code for
mezzanine-level or higher functions using source.
>> source source
source: func [
"Prints the source code for a word."
'word [word!]
][
prin join word ": "
if not value? word [print "undefined" exit]
either any [native? get word op? get word action? get word] [
print ["native" mold third get word]
] [print mold get word]
]
If you do source on the function that Romano uses, make-face, you will see
that at one point it gets a base style by using get-style which ends up
doing essentially what I did. 'make-face is a more complete and generic
wrapper around what I did manually.
I hope this submission makes sense. And, by the way, reading the system
source is great way to learn some great tricks from the masters: the RT
folks themselves! On a freshly started REBOL console, paste the following
and *be patient*:
echo %//windows/desktop/system.txt
probe system
quit
Then puruse system.txt to your hearts content.
--Scott Jones