[plt-scheme] requiring .plt files without installation?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Sep 2 11:01:13 EDT 2003

At Sat, 30 Aug 2003 15:20:46 -0400 (EDT), Ryan Jarvis wrote:
> 	My problem is the programs are going to be viewed under Unix (or a
> Unix shell) using MzScheme.  The university has MzScheme installed on the
> network however I don't believe SGL is installed.
> 	Is there some way I could, say add a startup file flag, to the
> command line in MzScheme so that it could somehow load up the SGL library
> (I guess load up the src.plt file) and the execute my program without
> having the administrators install SGL over the entire network?

When we created the SGL .plt files, a few of us breifly debated whether
it should install into user space or DrScheme installation space. Our
main conclusion was that it should be done differently in the future...

Meanwhile, ere's a .plt that should work for you:


For the record, below is a module that will take a .plt in stdin and
produce a nearly equivalent .plt to stdout. The output .plt should
install itself into user space.


(module not-plthome-rel mzscheme
  (require (lib "base64.ss" "net")
	   (lib "thread.ss")
	   (lib "inflate.ss")
	   (lib "deflate.ss"))

  (define (set-plt-home-#f in out)
    (when (regexp-match #rx"[(][(]plt-home-relative[?][)] #t[)]"
			in 0 #f
      (fprintf out "((plt-home-relative?) #f)")
      (copy-port in out)))

  (define (xform in out l)
     [(null? l) (xform1 in out copy-port)]
     [(null? (cdr l))
      (xform1 in out (car l))]
     [else (let-values ([(r w) (make-pipe 40960)])
	     (xform1 in w (car l))
	     (xform r out (cdr l)))]))

  (define (xform1 in out p)
    (thread (lambda ()
	      (p in out)
	      (close-output-port out))))

   (xform (current-input-port)
	   (lambda (in out) 
	     (gzip-through-ports in out #f (current-seconds)))

Posted on the users mailing list.