[self-interest] How to export sources as text
Jecel Assumpcao Jr
jecel at merlintec.com
Wed Jun 27 23:15:50 UTC 2001
Jesse,
if you execute
inspect: traits morph
you will get a reasonable print out in the terminal window where you
started Self. Depending on the GUI you are using, the easiest solution
is to copy the result and paste it into some text editor. 'inspect:' is
implemented in defaultBehavior and uses 'inspectReflectee:', which
unfortunately uses 'print' so it can't send the output to a file
instead of the terminal. It would be easy to copy this method to change
that, however.
But Self includes a sophisticated text export and import mechanism
called "the transporter". Every object and every slot can be annotated
as belonging to some "module" which is associated with a .self source
file. This means that a single object can have its definition divided
among several modules (files), each dealing with a different aspect of
it. And a module can include the (partial) definition for many objects.
If you look at the result of the "inspect: traits morph" above or if
you open up an outliner on traits morph (just type "traits morph" in
any evaluator and press the "get it" button. Then press the small
triangle in the result to open it up) you will see "9 modules".
The traits morph object itself is defined in module "morph", but its
slots belong to the "activity", "editorMorph", "morph", "morphSaving",
"outliner", "structuredEditing", "ui2Button", "ui2Menu" and
"webBrowser" modules. All you have to do is execute expressions like
modules morph fileOut
and you will have a "morph.self" file (it will be in a ui2
subdirectory, and if you don't have that you might get an error). I
find these files far less readable than what it generated by 'inspect:'
since there is a lot of slot declaration overhead, but the method
sources themselves are the same.
A more graphical way of doing this is to point to the background and
choose "changed modules" from the middle button menu. A pink object
should appear, but unless you have changed something it will be empty.
You can use the middle button on it to choose "All Modules" which will
give you an outliner view of all modules in the system. You can expand
a few levels to get to morph (all2->allUI2) and just press the small
"w" button beside it to write out the file.
Good luck,
-- Jecel
More information about the Self-interest
mailing list