summaryrefslogtreecommitdiffstats
path: root/DrScheme.init
diff options
context:
space:
mode:
Diffstat (limited to 'DrScheme.init')
-rw-r--r--DrScheme.init61
1 files changed, 57 insertions, 4 deletions
diff --git a/DrScheme.init b/DrScheme.init
index 0676250..9942897 100644
--- a/DrScheme.init
+++ b/DrScheme.init
@@ -1,6 +1,59 @@
;;;"DrScheme.init" Initialization for SLIB for DrScheme -*-scheme-*-
-;; Friedrich Dominicus <frido@q-software-solutions.com>
-;; Newsgroups: comp.lang.scheme
-;; Date: 02 Oct 2000 09:24:57 +0200
+;;; Author: Aubrey Jaffer
+;;;
+;;; This code is in the public domain.
-(require-library "init.ss" "slibinit")
+(define (make-exchanger obj)
+ (lambda (rep) (let ((old obj)) (set! obj rep) old)))
+(define (open-file filename modes)
+ (case modes
+ ((r rb) (open-input-file filename))
+ ((w wb) (open-output-file filename))
+ (else (slib:error 'open-file 'mode? modes))))
+;;(define (port? obj) (or (input-port? port) (output-port? port)))
+(define (call-with-open-ports . ports)
+ (define proc (car ports))
+ (cond ((procedure? proc) (set! ports (cdr ports)))
+ (else (set! ports (reverse ports))
+ (set! proc (car ports))
+ (set! ports (reverse (cdr ports)))))
+ (let ((ans (apply proc ports)))
+ (for-each close-port ports)
+ ans))
+(define (close-port port)
+ (cond ((input-port? port)
+ (close-input-port port)
+ (if (output-port? port) (close-output-port port)))
+ ((output-port? port) (close-output-port port))
+ (else (slib:error 'close-port 'port? port))))
+
+(define (browse-url url)
+ (define (try cmd end) (zero? (system (string-append cmd url end))))
+ (or (try "netscape-remote -remote 'openURL(" ")'")
+ (try "netscape -remote 'openURL(" ")'")
+ (try "netscape '" "'&")
+ (try "netscape '" "'")))
+
+(cond ((string<? (version) "200")
+ (require-library "init.ss" "slibinit"))
+ (else
+ (load (build-path (collection-path "slibinit") "init.ss"))
+ (eval '(require (lib "defmacro.ss")))
+ (slib:provide 'defmacro)))
+
+;;;The rest corrects mistakes in
+;;;/usr/local/lib/plt/collects/slibinit/init.ss:
+
+(provide 'fluid-let)
+
+(define slib:warn
+ (lambda args
+ (let ((cep (current-error-port)))
+ (if (provided? 'trace) (print-call-stack cep))
+ (display "Warn: " cep)
+ (for-each (lambda (x) (display #\ cep) (write x cep)) args))))
+
+(define call-with-input-string
+ (lambda (string thunk)
+ (parameterize ((current-input-port (open-input-string string)))
+ (thunk (current-input-port)))))