diff --git a/README b/README index 7dbdd2266..d18312525 100644 --- a/README +++ b/README @@ -1,10 +1,87 @@ -This is Mezzanine, an operating system written in Common Lisp. +Mezzanine, an operating system written in Common Lisp. -Need to update the README... +C- means to hold the control key while typing . +M- means to hold the alt or meta key while typing . +Alphabetic keys typed with control or meta ignore case. C-A and C-a are the same key, while C-! and C-1 are different. -Use Alt+F12 to switch between En-GB and En-US keymaps. +Use M-F12 to switch between En-GB and En-US keymaps. Windows can be moved by holding the Alt key and dragging. +Line editing +------------ +The line editor supports most standard line navigation and editing commands. +There is no command completion support yet. + +C-F Move forward (right) one character, also bound to Right-Arrow. +C-B Move backward (left) one character, also bound to Left-Arrow. +C-A Move to beginning of line, also bound to Home. +C-E Move to end of line, also bound to End. +M-F Move forward one word. +M-B Move backward one word. +M-P Find previous (older) matching history item, also bound to Up-Arrow. +M-N Find next (newer) matching history item, also bound to Down-Arrow. +C-D Delete the next character, also bound to Delete. +Backspace Delete the previous character. +M-D Delete the next word. +M-Backspace Delete the previous word. +C-K Delete from the cursor to the end of the line. +C-C Enter the debugger using BREAK. +C-G Invoke the most recent ABORT restart. This will usually clear any input and return you to a prompt. + +Editor commands +--------------- +The editor mostly follows Emacs conventions, but currently lacks a minibuffer and message pane. + +C-F Move forward (right) one character, also bound to Right-Arrow. +C-B Move backward (left) one character, also bound to Left-Arrow. +C-N Move to the next line (down), also bound to Down-Arrow. +C-P Move to the previous line (up), also bound to Up-Arrow. +C-A Move to beginning of line. +C-E Move to end of line. +M-< Move to the beginning of the buffer, also bound to Home. +M-> Move to the end of the buffer, also bound to End. +C-V Move the point to the bottom of the screen and recenter, also bound to Page-Down. +M-V Move the point to the top of the screen and recenter, also bound to Page-Up. +M-F Move forward one word. +M-B Move backward one word. +C-M-F Move forward one s-expression. +C-M-F Move backward one s-expression. +C-D Delete the next character, also bound to Delete. +Backspace Delete the previous character. +M-D Kill the next word. +M-Backspace Kill the previous word. +C-K Kill characters from the point to the end of the line, or kill the newline if the point is at the end of the line. +C-M-K Kill the next s-expression forward. +C-W Kill the area between the point and the mark. +C-Y Yank the last killed text back into the buffer at the point. +C-L Recenter the display on the point. +M-L Redraw the screen. +C-Q Insert the next key typed without intepretting it as a command. +C-Space If the point is at the mark and the mark is active, deactivate the mark. Otherwise, activate the mark and move it to the point. +C-X C-X Swap the point and the mark. +C-X C-F Open or create a file. +C-X C-S Save the current buffer. If the buffer has no path, you will be prompted for a location to save it. +C-X C-W Save the current buffer with a new path. +C-X b Switch to a different buffer. +C-X C-B List buffers. +C-X k Close an open buffer. +C-G Abort the current command. +C-C C-C Evaluate the current top-level form. +C-C C-A Move to the start of the current top-level form. + +Blinkenlights +------------- +A number of status lights are displayed at the top left of the screen. +From left to right: +Green Disk read in progress. +Red Disk write in progress. +Purple GC in progress. +Cyan Activity, system is not idle. +Yellow Snapshot in progress. +Brown Page fault being serviced. + +The entire top line will turn red if the system panics. + Included Libraries ------------------ ASDF 2.26 @@ -23,3 +100,17 @@ Full copyright notices and licences are available under LOCAL:>Licences> Licensed under CC BY-SA 3.0 via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Mandarin_Pair.jpg Some icons from Icojam (http://www.icojam.com) + + + +Extremely experimental whole-system transparent persistence support +------------------------------------------------------- +You will wreck your install if you try using this feature. +Take a snapshot using your virtual machine before using it, or back up your disk. + +Close all running programs (optional, strongly recommended). +Run (mezzanine.supervisor:snapshot) in a REPL. +Wait for the yellow light to turn off. +Reboot. + +If the system does not boot properly then restore your backup and try again. diff --git a/ipl.lisp b/ipl.lisp index 466d43820..e79aba694 100644 --- a/ipl.lisp +++ b/ipl.lisp @@ -1,6 +1,127 @@ (in-package :cl-user) -(mezzanine.file-system.remote:add-simple-file-host :that-mac-thing '(192 168 1 13)) -(setf *default-pathname-defaults* (make-pathname :host :that-mac-thing +;; Fast eval mode. +(setf sys.int::*eval-hook* 'mezzanine.fast-eval:eval-in-lexenv) + +;; Host where the initial system is kept. +(mezzanine.file-system.remote:add-simple-file-host :remote '(192 168 0 4)) +;; Use MAKE-PATHNAME instead of #p because the cross-compiler doesn't support #p. +(setf *default-pathname-defaults* (make-pathname :host :remote :directory '(:absolute "Users" "henry" "Documents" "Mezzanine"))) -(setf mezzanine.file-system::*home-directory* (make-pathname :directory '(:absolute "Users" "henry" "Documents" "Old Mezzanine Stuff" "LispOS-home"))) +(setf mezzanine.file-system::*home-directory* (make-pathname :host :remote + :directory '(:absolute "Users" "henry" "Documents" "Mezzanine-Home"))) + +(defun sys.int::snapshot-and-exit () + (mezzanine.supervisor:make-thread (lambda () + (dotimes (i 100) + (mezzanine.supervisor:wait-for-heartbeat)) + (sys.int::gc) + (mezzanine.supervisor:snapshot))) + (throw 'mezzanine.supervisor::terminate-thread nil)) + +(defun sys.int::cal (path) + "Compile and load PATH. +If the compiled file is out of date, recompile it." + (let ((compiled (compile-file-pathname path))) + (when (or (not (probe-file compiled)) + (<= (file-write-date compiled) (file-write-date path))) + (format t "; Compiling ~S~%" path) + (ignore-errors (delete-file compiled)) + (compile-file path)) + (format t "; Loading ~S~%" compiled) + (load compiled))) + +(defun sys.int::copy-file (filespec new-name &optional (element-type 'character) (source-external-format :default) (destination-external-format :default)) + (let* ((source (merge-pathnames filespec)) + (dest (merge-pathnames new-name source))) + (with-open-file (s source :element-type element-type :external-format source-external-format) + (with-open-file (d dest :direction :output :element-type element-type :external-format destination-external-format) + (cond ((subtypep element-type 'character) + ;; FILE-LENGTH cannot be trusted when doing character IO. Go line-by-line. + (loop + (multiple-value-bind (line missing-newline-p) + (read-line s nil) + (when (not line) + (return)) + (write-string line d) + (when (not missing-newline-p) + (terpri d))))) + (t (let ((seq (make-array (file-length s) :element-type element-type))) + (read-sequence seq s) + (write-sequence seq d)))))) + dest)) + +;; Local FS. +(sys.int::cal "file/local.lisp") +(eval (read-from-string "(mezzanine.file-system.local:add-local-file-host :local)")) + +;; Fonts. +(ensure-directories-exist "LOCAL:>Fonts>") +(dolist (f (directory (merge-pathnames "fonts/**/*.ttf" (user-homedir-pathname)))) + (sys.int::copy-file f + (merge-pathnames "LOCAL:>Fonts>" f) + '(unsigned-byte 8))) + +;; Icons. +(ensure-directories-exist "LOCAL:>Icons>") +(dolist (f (directory "gui/*.png")) + (sys.int::copy-file f + (merge-pathnames "LOCAL:>Icons>" f) + '(unsigned-byte 8))) +(dolist (f (directory (merge-pathnames "icons/**/*.png" (user-homedir-pathname)))) + (sys.int::copy-file f + (merge-pathnames "LOCAL:>Icons>" f) + '(unsigned-byte 8))) + +;; Hold on to your butts... +(ensure-directories-exist "LOCAL:>Licences>") +(dolist (f (directory (merge-pathnames "Licences/*.*" (user-homedir-pathname)))) + (sys.int::copy-file f + (merge-pathnames "LOCAL:>Licences>.text" f) + 'character)) + +;; Stuff. +(sys.int::copy-file (merge-pathnames "Mandarin_Pair.jpg" (user-homedir-pathname)) + "LOCAL:>Desktop.jpeg" + '(unsigned-byte 8)) + +(sys.int::copy-file "README" + "LOCAL:>README.text") + +;; ASDF. +(sys.int::cal (merge-pathnames "source/asdf.lisp" (user-homedir-pathname))) + +;; A bunch of GUI related systems. +(require :zpb-ttf) +(require :cl-vectors) +(require :cl-paths-ttf) +;; TCE is required for Chipz's decompressor. +(let ((sys.c::*perform-tce* t)) + (require :chipz)) +(require :png-read) +(require :cl-jpeg) + +;; And the GUI. +(sys.int::cal "gui/font.lisp") +(sys.int::cal "gui/widgets.lisp") +(sys.int::cal "line-edit-mixin.lisp") +(sys.int::cal "gui/popup-io-stream.lisp") +(sys.int::cal "gui/xterm.lisp") +(sys.int::cal "telnet.lisp") +(sys.int::cal "mandelbrot.lisp") +(sys.int::cal "irc.lisp") +(sys.int::cal "editor.lisp") +(sys.int::cal "gui/peek.lisp") +(sys.int::cal "gui/fancy-repl.lisp") +(sys.int::cal "gui/desktop.lisp") +(sys.int::cal "gui/image-viewer.lisp") +(sys.int::cal "gui/fs-viewer.lisp") +(setf sys.int::*desktop* (eval (read-from-string "(mezzanine.gui.desktop:spawn :image \"LOCAL:>Desktop.jpeg\")"))) + +;; Done. +(eval (read-from-string "(asdf:clear-configuration)")) +(defun lisp-implementation-version () + "Demo 1") +(setf mezzanine.file-system::*home-directory* (pathname "LOCAL:>") + *default-pathname-defaults* mezzanine.file-system::*home-directory*) +(setf (mezzanine.file-system:find-host :remote) nil)