summaryrefslogtreecommitdiffstats
path: root/pscheme.init
diff options
context:
space:
mode:
Diffstat (limited to 'pscheme.init')
-rw-r--r--pscheme.init44
1 files changed, 36 insertions, 8 deletions
diff --git a/pscheme.init b/pscheme.init
index 841f191..b791df6 100644
--- a/pscheme.init
+++ b/pscheme.init
@@ -2,7 +2,7 @@
;;; Author: Ben Goetter <goetter@mazama.net>
;;; last revised for 1.1.0 on 16 October 2000
;;; Initial work for 0.2.3 by Robert Goldman (goldman@htc.honeywell.com)
-;;; SLIB orig Author: Aubrey Jaffer (jaffer@ai.mit.edu)
+;;; SLIB orig Author: Aubrey Jaffer (agj @ alum.mit.edu)
;;;
;;; This code is in the public domain.
@@ -38,7 +38,7 @@
;; Scheme report features
-; rev5-report ;conforms to
+; r5rs ;conforms to
eval ;R5RS two-argument eval
; values ;R5RS multiple values
dynamic-wind ;R5RS dynamic-wind
@@ -52,11 +52,11 @@
;STRING-FILL!, LIST->VECTOR,
;VECTOR->LIST, and VECTOR-FILL!
- rev4-report ;conforms to
+ r4rs ;conforms to
ieee-p1178 ;conforms to
-; rev3-report ;conforms to
+; r3rs ;conforms to
; rev2-procedures ;SUBSTRING-MOVE-LEFT!,
;SUBSTRING-MOVE-RIGHT!,
@@ -67,7 +67,7 @@
multiarg/and- ;/ and - can take more than 2 args.
with-file ;has WITH-INPUT-FROM-FILE and
- ;WITH-OUTPUT-FROM-FILE
+ ;WITH-OUTPUT-TO-FILE
; transcript ;TRANSCRIPT-ON and TRANSCRIPT-OFF
; ieee-floating-point ;conforms to IEEE Standard 754-1985
;IEEE Standard for Binary
@@ -120,6 +120,37 @@
;; pscheme: current-error-port, delete-file, force-output already defined
+(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) (eqv? 0 (system (sprintf #f cmd url))))
+ (or (try "netscape-remote -remote 'openURL(%s)'")
+ (try "netscape -remote 'openURL(%s)'")
+ (try "netscape '%s'&")
+ (try "netscape '%s'")))
+
;;; CHAR-CODE-LIMIT is one greater than the largest integer which can
;;; be returned by CHAR->INTEGER.
;(define char-code-limit
@@ -231,7 +262,6 @@
;;; (SLIB:LOAD-SOURCE "foo") should load "foo.scm" or with whatever
;;; suffix all the module files in SLIB have. See feature 'SOURCE.
-
(define (slib:load-source f)
(if (not (file-exists? f))
(set! f (string-append f (scheme-file-suffix))))
@@ -240,11 +270,9 @@
;;; (SLIB:LOAD-COMPILED "foo") should load the file that was produced
;;; by compiling "foo.scm" if this implementation can compile files.
;;; See feature 'COMPILED.
-
(define slib:load-compiled load)
;;; At this point SLIB:LOAD must be able to load SLIB files.
-
(define slib:load slib:load-source)
;;; Pscheme and SLIB both define REQUIRE, so dispatch on argument type.