home *** CD-ROM | disk | FTP | other *** search
- ;;; ------------------------------------------------------------
- ;;; Menus for Scheme (tm)
- ;;; AN EXPERIMENTAL MENU-DRIVEN USER INTERFACE FOR PC SCHEME
- ;;; COMPILE MENU
- ;;; $Revision: 1.0 $ $Date: 14 Dec 1987 0:39:44 $
- ;;; ------------------------------------------------------------
- ;;; Copyright (c) 1987 by Morton Goldberg.
- ;;;
- ;;; Permission is granted to make copies of this program text
- ;;; for personal, non-commercial use provided this notice of
- ;;; copyright appears in all copies and derived works. All
- ;;; other rights reserved. In particular, you may not publish
- ;;; or otherwise distribute any copies of this text or any
- ;;; derived works without permission from the copyright holder.
- ;;; ------------------------------------------------------------
- ;;; Implementation Language: Texas Instruments' PC Scheme
- ;;; (Version 3.0)
- ;;; ------------------------------------------------------------
-
- (writeln "Menu-Driven User Interface -- Compile Menu")
- (writeln "Copyright (c) 1987 by Morton Goldberg")
- (let ((rev-number "$Revision: 1.0 $"))
- ;; Write the revision number string without the leading
- ;; and trailing dollar-signs (which are needed by the
- ;; version control system).
- (writeln (substring rev-number
- 1
- (sub1 (string-length rev-number)))))
-
- ;;; ------------------------------------------------------------
- ;;; COMPILE MENU
- ;;; ------------------------------------------------------------
- ;;; REMOVE THE EXTENSION FROM A FILE-SPEC STRING
-
- ;;; Given that `file-spec' is a string such as "foo.fsl",
- ;;; "foo.", or "foo", this procedure returns "foo".
- (define (remove-extension file-spec)
- ;; Look for #\. and return everything to the left of it.
- (let ((nn (substring-find-previous-char-in-set
- file-spec 0 (string-length file-spec) #\.)))
- (if nn
- (substring file-spec 0 nn)
- file-spec)))
-
- ;;; ------------------------------------------------------------
-
- ;;; Link to the top-level menu.
-
- ;;; Calling this menu function will create a menu of the *.S
- ;;; files in the current directory and display it. Assuming
- ;;; that the string "<name>.S" is chosen by the user, then (1)
- ;;; file <name>.S will be compiled to give the file <name>.SO,
- ;;; (2) <name>.SO will be converted to <name>.FSL, and (3)
- ;;; <name>.SO will be deleted.
- (define (compile-menu)
- (define s-file "")
- (define (choice-is a-string)
- (set! s-file a-string))
- (define menu
- (files->menu "*.S" 20 choice-is *vertical-menu-init*))
- (when menu
- (h-justify 'CENTER menu)
- (v-justify 'TOP menu)
- (send menu popup)
- (if (> (string-length s-file) 0)
- (let* ((base-name (remove-extension s-file))
- (so-file (string-append base-name ".SO"))
- (fsl-file (string-append base-name ".FSL"))
- (cmd-tail (string-append so-file " " fsl-file)))
- ;; Need a graceful way to handle compiler errors.
- (eval `(compile-file ,s-file ,so-file)
- user-initial-environment)
- (dos-call *make-fsl-spec* cmd-tail 16384)
- (dos-delete so-file))))
- *the-non-printing-object*)
-
- ;;; ------------------------------------------------------------
-