From 14464dee966fe415d4c8e1fb8b5205653b22003f Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 3 Oct 2022 19:22:23 -0400 Subject: Add prototype catbird modules. --- catbird/repl.scm | 349 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 catbird/repl.scm (limited to 'catbird/repl.scm') diff --git a/catbird/repl.scm b/catbird/repl.scm new file mode 100644 index 0000000..d3c2197 --- /dev/null +++ b/catbird/repl.scm @@ -0,0 +1,349 @@ +;; TODO: Multiple values +;; TODO: Multiple expressions +;; TODO: Debugger +;; TODO: Switching languages +(define-module (catbird repl) + #:use-module (catbird line-editor) + #:use-module (catbird kernel) + #:use-module (catbird mode) + #:use-module (catbird node) + #:use-module (catbird node-2d) + #:use-module (catbird region) + #:use-module (catbird ring-buffer) + #:use-module (catbird scene) + #:use-module (chickadee graphics color) + #:use-module (chickadee graphics path) + #:use-module (chickadee graphics text) + #:use-module (chickadee math vector) + #:use-module (ice-9 exceptions) + #:use-module (ice-9 match) + #:use-module (oop goops) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-9) + #:use-module (system base compile) + #:use-module (system base language) + #:export ( + + resize-repl)) + +(define %background-color (make-color 0.0 0.0 0.0 0.9)) + +(define (make-user-module) + (let ((module (resolve-module '(guile-user) #f))) + (beautify-user-module! module) + module)) + +(define-class () + (language #:accessor language #:init-value (lookup-language 'scheme)) + (module #:accessor module #:init-thunk make-user-module) + (max-line-length #:accessor max-line-length #:init-value 256) + (log-lines #:accessor log-lines #:init-form (make-ring-buffer 64))) + +(define-method (on-boot (repl )) + (attach-to repl + (make + #:name 'background) + (make