We updated the version of jor1k used in our System Programming playground project. This pull request contains some changes and enhancements which help in the development of our project.
This will close issue #58 I opened some time ago.
Support for multiple (two) terminals:
An array of terminals can be specified in the parameters passed to jor1k (currently the array is sliced to size 2 because there are two ttys). The index of the terminal in the array corresponds to its tty number.
The old jor1k term parameter is also supported (the old behavior of a single terminal), so the demos and other programs should not break.
The terminal plugins were modified to accept a tty parameter in the Init() function, so that they can attach to the correct tty.
Other API changes:
The main jor1k object now has two interface functions for interacting with terminals:
GetTerm(tty) returns the terminal object attached to a given tty. Currently not being used anywhere, but can be handy.
FocusTerm(tty) sets the lastMouseDownTarget to TERMINAL and sets the active terminal to the given tty. This lets someone programmatically set focus to a terminal, instead of using click and mousedown hacks. Our use case was to enhance the terminal switching and fullscreen button in the application.
The terminal plugins expose functions (SetCharReceiveListener and RemoveCharReceiveListener) for letting client code attach/remove a listener callback for capturing characters printing onto the terminal. This provides a clean abstraction over the terminal implementation. The compile demo has been updated to use this new interface.
Enhancements and bug fixes:
When Windows users check out the repository (with core.autocrlf=true), the VM files (like inittab) get modified with CRLF line endings, which causes trouble when loaded by the VM. Added a .gitattributes file to the bin/ folder which ensures that the text files in the VM sysroot have LF line endings. See the GitHub help article for more information.
When an exception occurs and the VM is stopped, the page got stuck in an infinite loop and printed Master: Abort continuously. This was caused due to a subtle bug in the messagehandler modules, where the Error() function and the Error JavaScript built-in object conflicted. Fixed this by renaming the Error() function inside the module (the exported name is still Error).
Other fixes and refactorings, please see the commit messages for more information.
The built code bundle is also in sync with the latest changes.
We updated the version of jor1k used in our System Programming playground project. This pull request contains some changes and enhancements which help in the development of our project.
This will close issue #58 I opened some time ago.
Support for multiple (two) terminals:
term
parameter is also supported (the old behavior of a single terminal), so the demos and other programs should not break.tty
parameter in theInit()
function, so that they can attach to the correct tty.Other API changes:
GetTerm(tty)
returns the terminal object attached to a given tty. Currently not being used anywhere, but can be handy.FocusTerm(tty)
sets thelastMouseDownTarget
toTERMINAL
and sets the active terminal to the given tty. This lets someone programmatically set focus to a terminal, instead of using click and mousedown hacks. Our use case was to enhance the terminal switching and fullscreen button in the application.SetCharReceiveListener
andRemoveCharReceiveListener
) for letting client code attach/remove a listener callback for capturing characters printing onto the terminal. This provides a clean abstraction over the terminal implementation. The compile demo has been updated to use this new interface.Enhancements and bug fixes:
core.autocrlf=true
), the VM files (likeinittab
) get modified withCRLF
line endings, which causes trouble when loaded by the VM. Added a.gitattributes
file to thebin/
folder which ensures that the text files in the VM sysroot haveLF
line endings. See the GitHub help article for more information.Master: Abort
continuously. This was caused due to a subtle bug in themessagehandler
modules, where theError()
function and theError
JavaScript built-in object conflicted. Fixed this by renaming theError()
function inside the module (the exported name is stillError
).