aboutsummaryrefslogtreecommitdiff
path: root/scheme/batch.scm
diff options
context:
space:
mode:
Diffstat (limited to 'scheme/batch.scm')
-rw-r--r--scheme/batch.scm46
1 files changed, 46 insertions, 0 deletions
diff --git a/scheme/batch.scm b/scheme/batch.scm
new file mode 100644
index 0000000..5fa368c
--- /dev/null
+++ b/scheme/batch.scm
@@ -0,0 +1,46 @@
+;; This file is part of Idest
+;; Copyright (C) 2011 Sergey Poznyakoff
+;; Idest 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, or (at your option)
+;; any later version.
+;;
+;; Idest 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 Idest. If not, see <http://www.gnu.org/licenses/>.
+
+(let ((cmd (command-line))
+ (mod-pathname #f)
+ (saved-load-hook %load-hook))
+
+ (set! %load-hook (lambda (filename)
+ (set! mod-pathname filename)
+ (set! %load-hook saved-load-hook)))
+
+ (let ((mod-name (list-ref cmd 1)))
+ (set-program-arguments (list-tail cmd 1))
+
+ (catch 'misc-error
+ (lambda ()
+ (set! idest-main
+ (module-ref
+ (resolve-module
+ (list 'idest 'batch (string->symbol mod-name)))
+ 'idest-main)))
+ (lambda (key port message args sys-error)
+ (with-output-to-port
+ (current-error-port)
+ (cond
+ ((not mod-pathname)
+ (format #t
+ "idest: no such batch: ~A~%" mod-name)
+ (exit 1))
+ (else
+ (apply format #t (string-append "idest: " message) args)
+ (newline)
+ (exit 1))))))
+ (set! idest-readonly #f)))

Return to:

Send suggestions and report system problems to the System administrator.