home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-26 | 2.8 KB | 77 lines | [TEXT/gamI] |
- (##declare
- (multilisp)
- (extended-bindings)
- (not safe)
- (not autotouch)
- (block)
- (fixnum))
-
- ;------------------------------------------------------------------------------
-
- (let ((mh (mac#getmenu 134)))
- (if (##not (##fixnum.= mh 0))
- (begin
- (if (##not (##procedure? c#cf)) (mac#disableitem mh 2))
- (mac#insertmenu mh 0)
- (mac#drawmenubar)
- (set! mac#menuselection
- (lambda (selection)
- (let ((menu (mac#getmhandle (##fixnum.ash selection -16)))
- (item (##fixnum.logand selection 65535)))
- (if (##fixnum.= menu mh)
- (cond ((##fixnum.= item 1)
- (let ((filename (mac#sfgetfile "Select file to load" "TEXTgamO")))
- (if filename
- (begin
- (##display "Loading " ##stdout #f)
- (##write filename ##stdout #f)
- (##newline ##stdout)
- (##load filename #f)))))
- ((##fixnum.= item 2)
- (let ((filename (mac#sfgetfile "Select file to compile" "TEXT")))
- (if filename
- (begin
- (##display "Compiling " ##stdout #f)
- (##write filename ##stdout #f)
- (##newline ##stdout)
- (c#cf filename 'm68000)))))))
- (mac#hilitemenu 0)
- ##unprint-object))))))
-
- (set! c#pinpoint-error
- (lambda (filename line char)
- (mac#sysbeep 10)
- (mac#edit filename line char)
- #t))
-
- ;------------------------------------------------------------------------------
-
- (##display "MacGambit (v2.0)" ##stdout #f)
- (##newline ##stdout)
-
- (let* ((repl-info (##make-vector 4 #f))
- (dyn-bindings (##list (##cons '##REPL-INFO repl-info))))
- (##call-with-current-continuation
- (lambda (abort)
- (##vector-set! repl-info 0 ##stdin)
- (##vector-set! repl-info 1 ##stdout)
- (##vector-set! repl-info 2 0)
- (##vector-set! repl-info 3 (##cons abort '()))
- (##dynamic-bind
- dyn-bindings
- (lambda ()
- (let ((init (##open-input-file "init.scm")))
- (if init (begin (##close-port init) (##load "init.scm" #f))
- (let ((x (##vector-ref ##argv 0)))
- (let loop ((i (##string-length x)))
- (if (##fixnum.< 0 i)
- (if (##not (##char=? (##string-ref x (##fixnum.- i 1)) #\:))
- (loop (##fixnum.- i 1))
- (let ((s (##string-append (##substring x 0 i) "init.scm")))
- (let ((init (##open-input-file s)))
- (if init (begin (##close-port init) (##load s #f))))))))))))))))
-
- (##repl)
-
- ;------------------------------------------------------------------------------
-