summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-10-10 01:49:49 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-10-10 01:49:49 +0200
commitedbb67e675163d7a3cfbeaf9fcbcef3f44146d36 (patch)
treeab17f19b7c3266df41fe0fbf8c95efe6ce36a072
parentd3593a4dcb13f15b531cee7e71e61a1e1f604ba4 (diff)
downloadgeiser-chez-edbb67e675163d7a3cfbeaf9fcbcef3f44146d36.tar.gz
geiser-chez-edbb67e675163d7a3cfbeaf9fcbcef3f44146d36.tar.bz2
Base R6RS elisp implementation.
-rw-r--r--elisp/geiser-r6rs.el50
1 files changed, 50 insertions, 0 deletions
diff --git a/elisp/geiser-r6rs.el b/elisp/geiser-r6rs.el
new file mode 100644
index 0000000..48c33d9
--- /dev/null
+++ b/elisp/geiser-r6rs.el
@@ -0,0 +1,50 @@
+;;; geiser-r6rs.el -- Generic support for R6RS implementations
+
+;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the Modified BSD License. You should
+;; have received a copy of the license along with this program. If
+;; not, see <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>.
+
+;; Start date: Thu Sep 24, 2009 15:06
+
+
+(require 'geiser-impl)
+(require 'geiser-base)
+
+
+
+(defun geiser-r6rs--marshall-procedure (proc)
+ `(eval ,proc '(geiser)))
+
+(defun geiser-r6rs--find-library (&optional name)
+ (cond ((null name)
+ (save-excursion
+ (while (not (zerop (geiser-syntax--nesting-level)))
+ (backward-up-list))
+ (when (re-search-forward "\\=(library +(" nil t)
+ (backward-char)
+ (geiser-syntax--read/list))))
+ ((listp name) name)
+ ((stringp name)
+ (let ((name (car (geiser-syntax--read-from-string name))))
+ (and (listp name) name)))))
+
+(defun geiser-r6rs--check ()
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward "^(library[ \t]" nil t)))
+
+
+;;; Base class for R6RS implementations:
+
+(geiser-impl--define load-file-name 'r6rs nil
+ '(marshall-procedure geiser-r6rs--marshall-procedure)
+ '(find-module geiser-r6rs--find-library)
+ '(check-buffer geiser-r6rs--check))
+
+
+(provide 'geiser-r6rs)
+;;; geiser-r6rs.el ends here
+