⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csc.scm

📁 Scheme跨平台编译器
💻 SCM
📖 第 1 页 / 共 3 页
字号:
;;;; csc.scm - Driver program for the CHICKEN compiler - felix -*- Hen -*-;; Copyright (c) 2000-2007, Felix L. Winkelmann; Copyright (c) 2008, The Chicken Team; All rights reserved.;; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following; conditions are met:;;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following;     disclaimer. ;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following;     disclaimer in the documentation and/or other materials provided with the distribution. ;   Neither the name of the author nor the names of its contributors may be used to endorse or promote;     products derived from this software without specific prior written permission. ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE; POSSIBILITY OF SUCH DAMAGE.(declare  (block)  (uses data-structures ports srfi-1 srfi-13 utils files extras ))#>#ifndef C_TARGET_CC# define C_TARGET_CC  C_INSTALL_CC#endif#ifndef C_TARGET_CXX# define C_TARGET_CXX  C_INSTALL_CXX#endif#ifndef C_TARGET_CFLAGS# define C_TARGET_CFLAGS  C_INSTALL_CFLAGS#endif#ifndef C_TARGET_LDFLAGS# define C_TARGET_LDFLAGS  C_INSTALL_LDFLAGS#endif#ifndef C_TARGET_BIN_HOME# define C_TARGET_BIN_HOME  C_INSTALL_BIN_HOME#endif#ifndef C_TARGET_LIB_HOME# define C_TARGET_LIB_HOME  C_INSTALL_LIB_HOME#endif#ifndef C_TARGET_STATIC_LIB_HOME# define C_TARGET_STATIC_LIB_HOME  C_INSTALL_STATIC_LIB_HOME#endif#ifndef C_TARGET_INCLUDE_HOME# define C_TARGET_INCLUDE_HOME  C_INSTALL_INCLUDE_HOME#endif#ifndef C_TARGET_SHARE_HOME# define C_TARGET_SHARE_HOME  C_INSTALL_SHARE_HOME#endif#ifndef C_TARGET_RUN_LIB_HOME# define C_TARGET_RUN_LIB_HOME    C_TARGET_LIB_HOME#endif#ifndef C_CHICKEN_PROGRAM# define C_CHICKEN_PROGRAM     "chicken"#endif<#(define-foreign-variable INSTALL_BIN_HOME c-string "C_INSTALL_BIN_HOME")(define-foreign-variable INSTALL_CC c-string "C_INSTALL_CC")(define-foreign-variable INSTALL_CXX c-string "C_INSTALL_CXX")(define-foreign-variable TARGET_CC c-string "C_TARGET_CC")(define-foreign-variable TARGET_CXX c-string "C_TARGET_CXX")(define-foreign-variable TARGET_CFLAGS c-string "C_TARGET_CFLAGS")(define-foreign-variable INSTALL_CFLAGS c-string "C_INSTALL_CFLAGS")(define-foreign-variable TARGET_LDFLAGS c-string "C_TARGET_LDFLAGS")(define-foreign-variable INSTALL_LDFLAGS c-string "C_INSTALL_LDFLAGS")(define-foreign-variable INSTALL_MORE_LIBS c-string "C_INSTALL_MORE_LIBS")(define-foreign-variable INSTALL_MORE_STATIC_LIBS c-string "C_INSTALL_MORE_STATIC_LIBS")(define-foreign-variable INSTALL_SHARE_HOME c-string "C_INSTALL_SHARE_HOME")(define-foreign-variable INSTALL_LIB_HOME c-string "C_INSTALL_LIB_HOME")(define-foreign-variable INSTALL_INCLUDE_HOME c-string "C_INSTALL_INCLUDE_HOME")(define-foreign-variable INSTALL_STATIC_LIB_HOME c-string "C_INSTALL_STATIC_LIB_HOME")(define-foreign-variable TARGET_MORE_LIBS c-string "C_TARGET_MORE_LIBS")(define-foreign-variable TARGET_MORE_STATIC_LIBS c-string "C_TARGET_MORE_STATIC_LIBS")(define-foreign-variable TARGET_BIN_HOME c-string "C_TARGET_BIN_HOME")(define-foreign-variable TARGET_SHARE_HOME c-string "C_TARGET_SHARE_HOME")(define-foreign-variable TARGET_LIB_HOME c-string "C_TARGET_LIB_HOME")(define-foreign-variable TARGET_INCLUDE_HOME c-string "C_TARGET_INCLUDE_HOME")(define-foreign-variable TARGET_STATIC_LIB_HOME c-string "C_TARGET_STATIC_LIB_HOME")(define-foreign-variable TARGET_RUN_LIB_HOME c-string "C_TARGET_RUN_LIB_HOME")(define-foreign-variable CHICKEN_PROGRAM c-string "C_CHICKEN_PROGRAM");;; Parameters:(define mingw (eq? (build-platform) 'mingw32))(define msvc (eq? (build-platform) 'msvc))(define osx (eq? (software-version) 'macosx))(define hpux-hppa (and (eq? (software-version) 'hpux)                       (eq? (machine-type) 'hppa)))(define (quit msg . args)  (fprintf (current-error-port) "csc: ~?~%" msg args)  (exit 64) )(define chicken-prefix (getenv "CHICKEN_PREFIX"))(define arguments (command-line-arguments))(define host-mode (member "-host" arguments))(define cross-chicken (##sys#fudge 39))(define (prefix str dir default)  (if chicken-prefix      (make-pathname (list chicken-prefix dir) str)      default) )(define (quotewrap str)  (if (string-any char-whitespace? str)      (string-append "\"" str "\"")       str) )(define home  (quotewrap    (prefix "" "share" (if host-mode INSTALL_SHARE_HOME TARGET_SHARE_HOME))))(define translator  (quotewrap    (prefix "chicken" "bin"	   (make-pathname	    (if host-mode INSTALL_BIN_HOME TARGET_BIN_HOME)	    CHICKEN_PROGRAM))))(define compiler (quotewrap (if host-mode INSTALL_CC TARGET_CC)))(define c++-compiler (quotewrap (if host-mode INSTALL_CXX TARGET_CXX)))(define linker (quotewrap (if msvc "link" (if host-mode INSTALL_CC TARGET_CC))))(define c++-linker (quotewrap (if msvc "link" (if host-mode INSTALL_CXX TARGET_CXX))))(define object-extension (if msvc "obj" "o"))(define library-extension (if msvc "lib" "a"))(define link-output-flag (if msvc "-out:" "-o "))(define executable-extension (if msvc "exe" ""))(define compile-output-flag (if msvc "-Fo" "-o "))(define nonstatic-compilation-options '())(define shared-library-extension ##sys#load-dynamic-extension)(define default-translation-optimization-options '())(define pic-options (if (or mingw msvc) '("-DPIC") '("-fPIC" "-DPIC")))(define default-library (string-append                         (if msvc "libchicken-static." "libchicken.")                         library-extension))(define default-unsafe-library (string-append                                (if msvc "libuchicken-static." "libuchicken.")                                library-extension))(define cleanup-filename  (if (not mingw)      (lambda (s) (quotewrap s)) ; allow filenames w/ whitespace      (lambda (s) s)))(define default-compilation-optimization-options (string-split (if host-mode INSTALL_CFLAGS TARGET_CFLAGS)))(define best-compilation-optimization-options default-compilation-optimization-options)(define default-linking-optimization-options (string-split (if host-mode INSTALL_LDFLAGS TARGET_LDFLAGS)))(define best-linking-optimization-options default-linking-optimization-options)(define-constant simple-options  '(-explicit-use -no-trace -no-warnings -no-usual-integrations -optimize-leaf-routines -unsafe    -block -disable-interrupts -fixnum-arithmetic -to-stdout -profile -raw -accumulate-profile    -check-syntax -case-insensitive -benchmark-mode -shared -run-time-macros -no-lambda-info    -lambda-lift -dynamic -disable-stack-overflow-checks -emit-debug-info -check-imports    -emit-external-prototypes-first -inline -extension -release -static-extensions    -analyze-only -keep-shadowed-macros -disable-compiler-macros) )(define-constant complex-options  '(-debug -output-file -heap-size -nursery -stack-size -compiler -unit -uses -keyword-style    -optimize-level -include-path -database-size -extend -prelude -postlude -prologue -epilogue     -inline-limit -profile-name -disable-warning -import -require-static-extension    -feature -debug-level -heap-growth -heap-shrinkage -heap-initial-size -emit-exports    -compress-literals) )		; DEPRECATED(define-constant shortcuts  '((-h "-help")    (-s "-shared")    (|-E| "-extension")    (|-P| "-check-syntax")    (|-V| "-version")    (|-Ob| "-benchmark-mode")    (-f "-fixnum-arithmetic")    (|-D| "-feature")    (-i "-case-insensitive")    (|-K| "-keyword-style")    (|-X| "-extend")    (|-N| "-no-usual-integrations")    (|-G| "-check-imports")    (-x "-explicit-use")    (-u "-unsafe")    (-b "-block") ) )(define short-options  (string->list "PHhsfiENxubvwAOeWkctgG") );;; Variables:(define scheme-files '())(define generated-scheme-files '())(define c-files '())(define generated-c-files '())(define object-files '())(define generated-object-files '())(define cpp-mode #f)(define objc-mode #f)(define embedded #f)(define inquiry-only #f)(define show-cflags #f)(define show-ldflags #f)(define show-libs #f)(define dry-run #f)(define extra-libraries  (if host-mode      INSTALL_MORE_STATIC_LIBS      TARGET_MORE_STATIC_LIBS))(define extra-shared-libraries   (if host-mode       INSTALL_MORE_LIBS      TARGET_MORE_LIBS))(define default-library-files   (list   (quotewrap    (prefix default-library "lib"	    (string-append	     (if host-mode INSTALL_LIB_HOME TARGET_LIB_HOME)	     (string-append "/" default-library)))) ))(define default-shared-library-files (if msvc                                         (list (string-append "libchicken." library-extension))                                         '("-lchicken")))(define unsafe-library-files  (list   (quotewrap     (prefix default-unsafe-library "lib"	    (string-append 	     (if host-mode INSTALL_LIB_HOME TARGET_LIB_HOME)	     (string-append "/" default-unsafe-library)))) ))(define unsafe-shared-library-files (if msvc                                        (list (string-append "libuchicken." library-extension))                                        '("-luchicken")))(define gui-library-files default-library-files)(define gui-shared-library-files default-shared-library-files)(define library-files default-library-files)(define shared-library-files default-shared-library-files)(define translate-options '("-quiet"))(define include-dir  (let ((id (prefix "" "include" 		    (if host-mode INSTALL_INCLUDE_HOME TARGET_INCLUDE_HOME))))    (and (not (member id '("/usr/include" "")))	 id) ) )(define compile-options '())(define builtin-compile-options  (if include-dir (list (conc "-I" (quotewrap include-dir))) '()))(define compile-only-flag "-c")(define translation-optimization-options default-translation-optimization-options)(define compilation-optimization-options default-compilation-optimization-options)(define linking-optimization-options default-linking-optimization-options)(define library-dir  (prefix "" "lib"         (if host-mode             INSTALL_LIB_HOME             TARGET_LIB_HOME)) )(define link-options '())(define builtin-link-options  (cond ((or osx hpux-hppa mingw)	 (list (conc "-L" (quotewrap library-dir))))        (msvc         (list (conc "-LIBPATH:" (quotewrap library-dir))))	(else 	 (list	  (conc "-L" (quotewrap library-dir))	  (conc " -Wl,-R" (quotewrap (prefix "" "lib"					     (if host-mode						 INSTALL_LIB_HOME						 TARGET_RUN_LIB_HOME)))) ) ) ) )(define target-filename #f)(define verbose #f)(define keep-files #f)(define translate-only #f)(define compile-only #f)(define to-stdout #f)(define shared #f)(define static #f)(define static-libs #f)(define static-extensions #f)(define required-extensions '())(define gui #f);;; Display usage information:(define (usage)  (display"Usage: csc FILENAME | OPTION ...  `csc' is a driver program for the CHICKEN compiler. Any Scheme, C or object  files and all libraries given on the command line are translated, compiled or

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -