From: Chris Hanson Date: Thu, 3 May 2007 03:45:52 +0000 (+0000) Subject: Rewrite code to compile Scheme files; now "etc/compile.scm" contains X-Git-Tag: 20090517-FFI~596 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f53cae0019f96089b791804dc55a0eae86b6baf4;p=mit-scheme.git Rewrite code to compile Scheme files; now "etc/compile.scm" contains all of the compilation programs. Each shell script loads "etc/compile.scm" and invokes the appropriate entry point. Additionally, differences between native compilation and liarc compilation have been integrated, so that there are now fewer necessary scripts. --- diff --git a/v7/src/etc/build-bands.sh b/v7/src/etc/build-bands.sh index b4410cb62..c90818d3f 100755 --- a/v7/src/etc/build-bands.sh +++ b/v7/src/etc/build-bands.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: build-bands.sh,v 1.9 2007/05/02 13:49:02 cph Exp $ +# $Id: build-bands.sh,v 1.10 2007/05/03 03:45:51 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -23,15 +23,14 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301, USA. -( - cd runtime - ../microcode/scheme --library ../lib --fasl make.com <package '(CROSS-REFERENCE))) - (load "make")))) - (with-working-directory-pathname "sf" - (lambda () - (load "sf.sf") - (load "sf.cbf")))) + (load "etc/compile.scm") + (compile-bootstrap-1)) EOF # Step 2: Load CREF and SF, and syntax the compiler configured with # the C back end. -# (There *must* be a better way to write this...) - -LOAD_SF_CREF=' -(for-each (lambda (subdirectory) - (with-working-directory-pathname subdirectory - (lambda () - (load "make")))) - (quote ("cref" "sf"))) -' - +echo "${SCHEME_LARGE}" ${SCHEME_LARGE} <package '(CROSS-REFERENCE))) - (load "make")))) - (for-each - (lambda (subsystem) - (with-working-directory-pathname subsystem - (lambda () - (load (pathname-new-type subsystem "sf")) - (load (pathname-new-type subsystem "cbf")) - (if (string=? subsystem "compiler") ;++ kludge - (cbf "compiler-unx.pkd") - (compile-package-descriptions subsystem))))) - '("runtime" "win32" "sf" "compiler" "edwin" "6001")) - (with-working-directory-pathname "star-parser" - (lambda () - (load "compile") - (compile-package-descriptions "parser"))) - (for-each (lambda (subsystem) - (load (merge-pathnames "compile" - (pathname-as-directory subsystem))) - (with-working-directory-pathname subsystem - (lambda () - (compile-package-descriptions subsystem)))) - '("sos" "imail" "xml" "ssp" "xdoc"))) diff --git a/v7/src/etc/c-compile.sh b/v7/src/etc/c-compile.sh index ff2b290b0..ca0022b50 100755 --- a/v7/src/etc/c-compile.sh +++ b/v7/src/etc/c-compile.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: c-compile.sh,v 1.3 2007/05/02 13:50:04 cph Exp $ +# $Id: c-compile.sh,v 1.4 2007/05/03 03:45:51 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -26,15 +26,23 @@ set -e if [ ${#} -ge 1 ]; then + echo "cd ${1}" cd "${1}" -elif [ -r etc/c-compile.scm ]; then +elif [ -r etc/compile.scm ]; then : else echo "usage: ${0} DIRECTORY" exit 1 fi -sh etc/c-initial-bands.sh +etc/build-runtime.sh -exec microcode/scheme --library lib --compiler --heap 6000 --stack 200 \ - < etc/c-compile.scm +echo "microcode/scheme --library lib --heap 6000 --stack 200" +exec microcode/scheme --library lib --heap 6000 --stack 200 < (file-modification-time-indirect "utabmd.scm") - (file-modification-time-indirect "utabmd.bin"))) - (sf "utabmd")) - (cbf "utabmd"))) - (for-each (lambda (subsystem) - (with-working-directory-pathname subsystem - (lambda () - (load (pathname-new-type subsystem "sf")) - (load (pathname-new-type subsystem "cbf")) - (compile-package-descriptions subsystem)))) - '("runtime" "sf" "cref")) - (with-working-directory-pathname "compiler" - (lambda () - (load "compiler.sf") - (load "compiler.cbf") - (cbf "compiler-unx.pkd"))) - (with-working-directory-pathname "star-parser" - (lambda () - (load "compile") - (compile-package-descriptions "parser")))) diff --git a/v7/src/etc/c-prepare.sh b/v7/src/etc/c-prepare.sh index 4cda53643..f4c396c21 100755 --- a/v7/src/etc/c-prepare.sh +++ b/v7/src/etc/c-prepare.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: c-prepare.sh,v 1.2 2007/04/29 20:46:43 cph Exp $ +# $Id: c-prepare.sh,v 1.3 2007/05/03 03:45:52 cph Exp $ # # Copyright 2007 Massachusetts Institute of Technology # @@ -23,17 +23,21 @@ set -e -if [ $# -ge 1 ]; then - DIR="${1}" -elif [ -r "./etc/c-prepare.scm" ]; then - DIR="." +if [ ${#} -ge 1 ]; then + cd "${1}" +elif [ -r etc/compile.scm ]; then + : else echo "usage: ${0} DIRECTORY" exit 1 fi if [ -z "${SCHEME_LARGE}" ]; then - SCHEME_LARGE="scheme --heap 6000" + SCHEME_LARGE="mit-scheme --heap 6000" fi -${SCHEME_LARGE} --band boot-compiler.com < "${DIR}/etc/c-prepare.scm" +${SCHEME_LARGE} --band boot-compiler.com <package '(CROSS-REFERENCE))) - (load "make")))) - (for-each (lambda (name) - (with-working-directory-pathname name - (lambda () - (load (pathname-new-type name "sf")) - (load (pathname-new-type name "cbf"))))) - '("runtime" "win32" "sf" "compiler" "edwin" "6001")) - (with-working-directory-pathname "cref" + (cond ((and (string=? name "compiler") + (eq? microcode-id/compiled-code-type 'C)) + (load "machines/C/make")) + ((file-exists? (pathname-new-type name "sf")) + (load "make")) + (else + (load "load")))))) + +(define (compile-everything) + (compile-dir "cref") + (if (not (name->package '(cross-reference))) + (load-dir "cref")) + (for-each compile-dir boot-dirs) + (for-each compile-dir non-boot-dirs)) + +(define (compile-bootstrap-1) + (compile-dir "cref") + (if (not (name->package '(cross-reference))) + (load-dir "cref")) + (compile-dir "sf")) + +(define (compile-bootstrap-2) + (load-dir "cref") + (load-dir "sf") + (with-working-directory-pathname "compiler" (lambda () - (if (not (file-exists? "cref.con")) - (load "cref.sf")))) - (for-each (lambda (name) - (load (merge-pathnames "compile" (pathname-as-directory name)))) - '("sos" "star-parser" "imail" "xml" "ssp" "xdoc"))) \ No newline at end of file + (load "compiler.sf")))) + +(define (compile-bootstrap-3) + (with-working-directory-pathname "compiler" + (lambda () + (load "compiler.cbf")))) + +(define (compile-bootstrap-4) + (load-dir "cref") + (load-dir "sf") + (load-dir "compiler")) + +(define (c-compile-dir name) + (compile-dir name) + (liarc-compile-pkgs name)) + +(define (c-compile-pkgs name) + (with-working-directory-pathname name + (lambda () + (cbf (string-append name "-unx.pkd")) + (if (not (string=? name "compiler")) ;kludge + (begin + (cbf (string-append name "-w32.pkd")) + (cbf (string-append name "-os2.pkd"))))))) + +(define (c-prepare) + (fluid-let ((compiler:invoke-c-compiler? #f)) + (for-each liarc-compile-dir boot-dirs))) + +(define (c-compile) + (fluid-let ((compiler:invoke-c-compiler? #f)) + (for-each liarc-compile-dir boot-dirs) + (for-each liarc-compile-dir non-boot-dirs))) \ No newline at end of file diff --git a/v7/src/etc/compile.sh b/v7/src/etc/compile.sh index 33292fd2d..cb917430a 100755 --- a/v7/src/etc/compile.sh +++ b/v7/src/etc/compile.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: compile.sh,v 1.10 2007/01/05 21:19:25 cph Exp $ +# $Id: compile.sh,v 1.11 2007/05/03 03:45:52 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -23,15 +23,25 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301, USA. -if [ $# -ge 1 ]; then - DIR="${1}" -elif [ -r "./etc/compile.scm" ]; then - DIR="." +set -e + +if [ ${#} -ge 1 ]; then + echo "cd ${1}" + cd "${1}" +elif [ -r etc/compile.scm ]; then + : else - echo "usage: ${0} DIRECTORY" - exit 1 + echo "usage: ${0} DIRECTORY" + exit 1 fi + if [ -z "${SCHEME_COMPILER}" ]; then - SCHEME_COMPILER="scheme --compiler --heap 3000" + SCHEME_COMPILER="mit-scheme --compiler --heap 6000 --stack 200" fi -${SCHEME_COMPILER} < "${DIR}/etc/compile.scm" + +echo "${SCHEME_COMPILER}" +exec ${SCHEME_COMPILER} <