summaryrefslogtreecommitdiff
path: root/scheme/geiser/eval.scm
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-10 23:33:21 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-10 23:33:21 +0100
commite48d59af292ca82e77733070cf3444ac2e0ba7df (patch)
treeee0d949cddacefcad6cfbd17352c26868dbe42b9 /scheme/geiser/eval.scm
parent6bc5dce3118a78e2665bbf981dc61866329269c1 (diff)
downloadgeiser-guile-e48d59af292ca82e77733070cf3444ac2e0ba7df.tar.gz
geiser-guile-e48d59af292ca82e77733070cf3444ac2e0ba7df.tar.bz2
Guile scheme files moved to scheme/guile.
Diffstat (limited to 'scheme/geiser/eval.scm')
-rw-r--r--scheme/geiser/eval.scm65
1 files changed, 0 insertions, 65 deletions
diff --git a/scheme/geiser/eval.scm b/scheme/geiser/eval.scm
deleted file mode 100644
index b7c5eef..0000000
--- a/scheme/geiser/eval.scm
+++ /dev/null
@@ -1,65 +0,0 @@
-;; eval.scm -- evaluation procedures
-
-;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
-
-;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
-;; Start date: Fri Feb 06, 2009 22:54
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This file is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;;; Comentary:
-
-;; Module defining evaluation procedures called from the Emacs side.
-
-;;; Code:
-
-(define-module (geiser eval)
- #:export (eval-in)
- #:use-module (srfi srfi-1))
-
-(define (eval-in form module-name)
- "Evals FORM in the module designated by MODULE-NAME.
-If MODULE-NAME is #f or resolution fails, the current module is used instead.
-The result is a list of the form ((RESULT . <form-value>) (OUTPUT . <string>))
-if no evaluation error happens, or ((ERROR (KEY . <error-key>) <error-arg>...))
-in case of errors. Each error arg is a cons (NAME . VALUE), where NAME includes
-SUBR, MSG and REST."
- (let ((module (or (and module-name (resolve-module module-name))
- (current-module))))
- (catch #t
- (lambda ()
- (let* ((result #f)
- (output
- (with-output-to-string
- (lambda ()
- (save-module-excursion
- (lambda ()
- (set-current-module module)
- (set! result (compile form))))))))
- (list (cons 'result result) (cons 'output output))))
- (lambda (key . args)
- (list (cons 'error (apply parse-error (cons key args))))))))
-
-(define (parse-error key . args)
- (let* ((len (length args))
- (subr (and (> len 0) (first args)))
- (msg (and (> len 1) (second args)))
- (margs (and (> len 2) (third args)))
- (rest (and (> len 3) (fourth args))))
- (list (cons 'key key)
- (cons 'subr (or subr '()))
- (cons 'msg (if msg (apply format (cons #f (cons msg margs))) '()))
- (cons 'rest (or rest '())))))
-
-;;; eval.scm ends here