SmartConsole stuff
Lendvai Attila
Attila.Lendvai at netvisor.hu
Fri Dec 17 11:11:44 PST 2004
Hi!
Recently I've added the possibility to compile plugins for the vm, and
implemented a smart console plugin that uses ncurses. You can compile it
with 'make plugins'.
The slate-side file is 'src/lib/smartconsole.slate'. After loading it,
the code below should run fine: (I've only tested it on cygwin)
[| c |
c: SmartConsole new.
c open.
[| e |
e: c nextEvent.
e keyName caseOf: {
#LeftArrow -> [
c moveCursorLeft.
].
#RightArrow -> [
c moveCursorRight.
].
#UpArrow -> [
c moveCursorUp.
].
#DownArrow -> [
c moveCursorDown.
].
} otherwise: [
e char ifNotNil: [
e keyCode >= 16r30 /\ [e keyCode <= 16r37] ifTrue: [
c setForeground: e keyCode - 16r30.
] ifFalse: [
e char = $\s ifTrue: [
c scroll.
] ifFalse: [
c write: e char.
].
].
].
].
c writeCursorPositionAt: 30 , 0 .
e char ifNil: [
False
] ifNotNil: [
e char = $q
]
] whileFalse.
c close.
] do.
You can move with the arrow keys, change colors with the numbers and
type characters, q quits.
For the vm to find the dll's/so's they must be in the dll search path.
This differs on platforms, unices use LD_LIBRARY_PATH, on windows PATH
is searched, but the directory where the exe is, is also searched (could
be it works on unices, too).
Todo:
- Transparently connect it to the repl/debugger
- Implement image startup/shutdown hooks/machinery (Lee? ideas,
guidance? :)
- The SmartConsolePlugin became ncurses dependent due to the 'strange'
color handling of ncurses, so it should be chopped into two: the base
functionality and the ncurses subtype. (Can wait until someone plans to
work on another plugin implementation)
Issues:
- Where to put the dll's: make install target
- Image save/startup hooks are needed to persist dll reference and
reopen on startup. This causes a crash if image is saved after the
plugin was loaded, then the saved image started and the SmartConsole
stuff is run. (Due to the invalid persisted dll pointer)
- Brian reported that it doesn't work on OS X, errors due to some
ncurses color stuff
It would be helpful is someone could take a look at it on linux/other
unices, but I'll try to test it myself as time permits.
Have fun,
- 101
More information about the Slate
mailing list