summaryrefslogtreecommitdiff
path: root/scheme
diff options
context:
space:
mode:
authormathieu2em <math.per@hotmail.com>2019-07-08 12:37:30 -0400
committermathieu2em <math.per@hotmail.com>2019-08-20 15:31:38 -0400
commit9ea52349fbdb06ffa3f51d817dd49afa62b644c4 (patch)
treea582e3c8e0e7d3401ba7c938077abc897dd45253 /scheme
parentaa493114c31640a1b326d80110b179a8fd9a4031 (diff)
downloadgeiser-guile-9ea52349fbdb06ffa3f51d817dd49afa62b644c4.tar.gz
geiser-guile-9ea52349fbdb06ffa3f51d817dd49afa62b644c4.tar.bz2
WIP repl behaviour fix
Diffstat (limited to 'scheme')
-rw-r--r--scheme/gambit/geiser/gambit.scm36
1 files changed, 34 insertions, 2 deletions
diff --git a/scheme/gambit/geiser/gambit.scm b/scheme/gambit/geiser/gambit.scm
index 805fe31..b63faa7 100644
--- a/scheme/gambit/geiser/gambit.scm
+++ b/scheme/gambit/geiser/gambit.scm
@@ -1,4 +1,36 @@
-;; TODO implement functions required by geiser
+;;;gambit.scm gambit geiser interaction
-(display "loaded gambit.scm\n")
+(define (geiser-load-file file)
+ (let* ((file (if (symbol? file) (symbol->string file) file))
+ (found-file (geiser-find-file file)))
+ (call-with-result
+ (lambda ()
+ (when found-file
+ (load found-file))))))
+(define (geiser:newline)
+ (newline))
+
+(define (geiser:no-values)
+ (values))
+
+;; Spawn a server for remote repl access TODO make it works with remote repl
+
+(define (geiser-start-server . rest)
+ (let* ((listener (tcp-listen 0))
+ (port (tcp-listener-port listener)))
+ (define (remote-repl)
+ (receive (in out) (tcp-accept listener)
+ (current-input-port in)
+ (current-output-port out)
+ (current-error-port out)
+
+ (repl)))
+
+ (thread-start! (make-thread remote-repl))
+
+ (write-to-log `(geiser-start-server . ,rest))
+ (write-to-log `(port ,port))
+
+ (write `(port ,port))
+ (newline)))