~ chicken-core (chicken-5) 95ed1c2d2c1ae12558d80bf7f5b5e12441729dd2


commit 95ed1c2d2c1ae12558d80bf7f5b5e12441729dd2
Author:     felix <bunny351@gmail.com>
AuthorDate: Mon Jun 7 12:52:28 2010 +0200
Commit:     felix <bunny351@gmail.com>
CommitDate: Mon Jun 7 12:52:28 2010 +0200

    added -no-feature option; boot-chicken target does multistage build

diff --git a/batch-driver.scm b/batch-driver.scm
index 5e620819..415d7e56 100644
--- a/batch-driver.scm
+++ b/batch-driver.scm
@@ -278,6 +278,9 @@
     (for-each 
      register-feature!
      (append-map (cut string-split <> ",") (collect-options 'feature)))
+    (for-each 
+     unregister-feature!
+     (append-map (cut string-split <> ",") (collect-options 'no-feature)))
 
     ;; Load extensions:
     (set! ##sys#features (cons #:compiler-extension ##sys#features))
diff --git a/c-platform.scm b/c-platform.scm
index d1332b34..f44504ca 100644
--- a/c-platform.scm
+++ b/c-platform.scm
@@ -99,7 +99,7 @@
     inline-limit profile-name 
     disable-warning			; OBSOLETE
     parenthesis-synonyms
-    prelude postlude prologue epilogue nursery extend feature types
+    prelude postlude prologue epilogue nursery extend feature no-feature types
     emit-import-library emit-inline-file static-extension consult-inline-file
     heap-growth heap-shrinkage heap-initial-size ffi-define ffi-include-path) )
 
diff --git a/chicken-install.scm b/chicken-install.scm
index 5d4ab735..ccdfb74f 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -86,6 +86,7 @@
   (define *deploy* #f)
   (define *trunk* #f)
   (define *csc-features* '())
+  (define *csc-nonfeatures* '())
   (define *prefix* #f)
   (define *aliases* '())
 
@@ -393,7 +394,12 @@
 	   (sprintf " -e \"(destination-prefix \\\"~a\\\")\"" 
 	     (normalize-pathname prefix 'unix))
 	   ""))
-     (sprintf " -e \"(extra-features '~s)\"" *csc-features*)
+     (if (pair? *csc-features*)
+	 (sprintf " -e \"(extra-features '~s)\"" *csc-features*)
+	 "")
+     (if (pair? *csc-nonfeatures*)
+	 (sprintf " -e \"(extra-nonfeatures '~s)\"" *csc-nonfeatures*)
+	 "")
      (if *deploy* " -e \"(deployment-mode #t)\"" "")
      #\space
      (shellpath (make-pathname (cadr e+d+v) (car e+d+v) "setup"))) )
@@ -638,6 +644,11 @@ EOF
 			(set! *csc-features* 
 			  (cons (string->symbol (cadr args)) *csc-features*))
 			(loop (cddr args) eggs))
+		       ((string=? "-no-feature" arg)
+                        (unless (pair? (cdr args)) (usage 1))
+			(set! *csc-nonfeatures* 
+			  (cons (string->symbol (cadr args)) *csc-nonfeatures*))
+			(loop (cddr args) eggs))
                        ((string=? "-test" arg)
                         (set! *run-tests* #t)
                         (loop (cdr args) eggs))
diff --git a/csc.scm b/csc.scm
index fe9bf704..2661869d 100644
--- a/csc.scm
+++ b/csc.scm
@@ -146,7 +146,7 @@
     -disable-warning			; OBSOLETE
     -emit-inline-file -types
     -feature -debug-level -heap-growth -heap-shrinkage -heap-initial-size -consult-inline-file
-    -emit-import-library -static-extension))
+    -emit-import-library -static-extension -no-feature))
 
 (define-constant shortcuts
   '((-h "-help")
@@ -159,7 +159,7 @@
     (-i "-case-insensitive")
     (|-K| "-keyword-style")
     (|-X| "-extend")
-    (|-N| "-no-usual-integrations")
+    (|-N| "-no-usual-integrations")	; DEPRECATED
     (|-J| "-emit-all-import-libraries")
     (-x "-explicit-use")
     (-u "-unsafe")
@@ -311,6 +311,7 @@ Usage: #{csc} FILENAME | OPTION ...
   Language options:
 
     -D  -DSYMBOL  -feature SYMBOL  register feature identifier
+    -no-feature SYMBOL             disable builtin feature identifier
     -c++                           compile via a C++ source file (.cpp) 
     -objc                          compile via Objective-C source file (.m)
 
@@ -355,7 +356,7 @@ Usage: #{csc} FILENAME | OPTION ...
     -O -O0 -O1 -O2 -O3 -O4 -O5 -optimize-level NUMBER
                                    enable certain sets of optimization options
     -optimize-leaf-routines        enable leaf routine optimization
-    -N  -no-usual-integrations     standard procedures may be redefined
+    -no-usual-integrations         standard procedures may be redefined
     -u  -unsafe                    disable safety checks
     -local                         assume globals are only modified in current
                                     file
diff --git a/csi.scm b/csi.scm
index bcb10222..be2490a9 100644
--- a/csi.scm
+++ b/csi.scm
@@ -85,6 +85,7 @@ usage: csi [FILENAME | OPTION ...]
     -p  -print EXPRESSION         evaluate and print result(s)
     -P  -pretty-print EXPRESSION  evaluate and print result(s) prettily
     -D  -feature SYMBOL           register feature identifier
+        -no-feature SYMBOL        disable built-in feature identifier
     -q  -quiet                    do not print banner
 
 EOF
@@ -712,7 +713,7 @@ EOF
   '(#\k #\s #\v #\h #\D #\e #\i #\R #\b #\n #\q #\w #\- #\I #\p #\P) )
 
 (define-constant long-options
-  '("-ss" "-sx" "-script" "-version" "-help" "--help" "-feature" "-eval"
+  '("-ss" "-sx" "-script" "-version" "-help" "--help" "-feature" "-no-feature" "-eval"
     "-case-insensitive" "-keyword-style" "-no-parentheses-synonyms" "-no-symbol-escape"
     "-r5rs-syntax" "-setup-mode"
     "-require-extension" "-batch" "-quiet" "-no-warnings" "-no-init" 
@@ -823,6 +824,7 @@ EOF
 	(case-sensitive #f) )
       (for-each register-feature! (collect-options "-feature"))
       (for-each register-feature! (collect-options "-D"))
+      (for-each unregister-feature! (collect-options "-no-feature"))
       (set! ##sys#include-pathnames 
 	(deldups
 	 (append (map chop-separator (collect-options "-include-path"))
diff --git a/manual/Using the compiler b/manual/Using the compiler
index 8f56a35c..70661b90 100644
--- a/manual/Using the compiler	
+++ b/manual/Using the compiler	
@@ -128,6 +128,8 @@ the source text should be read from standard input.
 
 ; -no-bound-checks : disable bound variable checks
 
+; -no-feature SYMBOL : Disables the predefined feature-identifier {{SYMBOL}}. Multiple symbols may be given, if comma-separated.
+
 ; -no-lambda-info : Don't emit additional information for each {{lambda}} expression (currently the argument-list, after alpha-conversion/renaming).
 
 ; -no-parentheses-synonyms STYLE : Disables list delimiter synonyms, [..] and {...} for (...).
diff --git a/rules.make b/rules.make
index 2ae5e228..825c21dd 100644
--- a/rules.make
+++ b/rules.make
@@ -1051,40 +1051,6 @@ check: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM)
 bench: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM)
 	cd tests; echo >>bench.log; date >>bench.log; sh runbench.sh 2>&1 | tee -a bench.log
 
-# 3-stage build
-
-.PHONY: stage1 stage2 stage3
-
-# stage1: build static compiler from current sources with whatever chicken is 
-#         currently available
-stage1:
-	$(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) PLATFORM=$(PLATFORM) \
-	  SRCDIR=$(SRCDIR) STATICBUILD=1 DEBUGBUILD=1 CHICKEN=$(CHICKEN) \
-	  confclean clean $(CHICKEN_PROGRAM)$(EXE)
-	$(COPY_COMMAND) $(CHICKEN_PROGRAM)$(EXE) $(CHICKEN_PROGRAM)-stage1$(EXE)
-	-chmod +x $(CHICKEN_PROGRAM)-stage1$(EXE)
-	-touch *.scm
-	$(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) SRCDIR=$(SRCDIR) stage2
-
-# stage2: build static chicken with compiler built from current sources, so that
-#         it supports all functionality that has recently been added
-stage2:
-	$(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) PLATFORM=$(PLATFORM) \
-	  SRCDIR=$(SRCDIR) STATICBUILD=1 DEBUGBUILD=1 \
-	  CHICKEN=./$(CHICKEN_PROGRAM)-stage1 clean $(CHICKEN_PROGRAM)$(EXE)
-	$(COPY_COMMAND) $(CHICKEN_PROGRAM) $(CHICKEN_PROGRAM)-stage2$(EXE)
-	-chmod +x $(CHICKEN_PROGRAM)-stage2$(EXE)
-	-touch *.scm
-	$(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) stage3
-
-# stage3: build whole system with compiler built from compiler built from current 
-#         sources - this should normally not be contaminated by old compilers
-#         or runtime libraries
-stage3:
-	$(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) PLATFORM=$(PLATFORM) \
-	  SRCDIR=$(SRCDIR) CONFIG=$(CONFIG) \
-	  CHICKEN=./$(CHICKEN_PROGRAM)-stage2 \
-	  confclean clean all
 
 # build current head in sub-directory
 
@@ -1103,5 +1069,20 @@ buildhead:
 
 boot-chicken:
 	$(MAKE) -f Makefile.$(PLATFORM) PLATFORM=$(PLATFORM) PREFIX=/nowhere CONFIG= \
-	  SRCDIR=$(SRCDIR) CHICKEN=$(CHICKEN) PROGRAM_SUFFIX=-boot STATICBUILD=1 \
-	  confclean chicken-boot$(EXE)
+	  SRCDIR=$(SRCDIR) CHICKEN=$(CHICKEN) PROGRAM_SUFFIX=-boot-stage1 STATICBUILD=1 \
+	  C_COMPILER_OPTIMIZATION_OPTIONS= \
+	  confclean chicken-boot-stage1$(EXE)
+	$(MAKE) -f Makefile.$(PLATFORM) PLATFORM=$(PLATFORM) PREFIX=/nowhere CONFIG= \
+	  SRCDIR=$(SRCDIR) CHICKEN=$(PWD)/chicken-boot-stage1$(EXE) PROGRAM_SUFFIX=-boot STATICBUILD=1 \
+	  C_COMPILER_OPTIMIZATION_OPTIONS= \
+	  touchfiles chicken-boot$(EXE) confclean
+
+.PHONY: touchfiles
+
+touchfiles:
+ifdef WINDOWS_SHELL
+	rem now is this funky or what?
+	for %x in (*.scm) do copy /b %x +,,
+else
+	touch *.scm
+endif
diff --git a/setup-api.scm b/setup-api.scm
index 5e30d889..26e5cdf1 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -51,7 +51,7 @@
      patch abort-setup
      setup-root-directory create-directory/parents
      test-compile try-compile run-verbose
-     extra-features
+     extra-features extra-nonfeatures
      copy-file move-file
      required-chicken-version required-extension-version
      sudo-install keep-intermediates
@@ -119,6 +119,13 @@
 		(set! xfs fs))
 	    (else xfs)))))
 
+(define extra-nonfeatures
+  (let ((xfs '()))
+    (lambda (#!optional fs)
+      (cond (fs (apply unregister-feature! fs)
+		(set! xfs fs))
+	    (else xfs)))))
+
 ; Setup shell commands
 
 (define *copy-command*)
@@ -231,8 +238,11 @@
 	(if (deployment-mode) "-deployed" "")
 	(append
 	 (map (lambda (f)
-		(string-append "-feature "(symbol->string f)))
+		(string-append "-feature " (symbol->string f)))
 	      (extra-features))
+	 (map (lambda (f)
+		(string-append "-no-feature " (symbol->string f)))
+	      (extra-nonfeatures))
 	 *csc-options*) )
        " ")
       (find-program prg)))
diff --git a/support.scm b/support.scm
index e44eff9e..110958ec 100644
--- a/support.scm
+++ b/support.scm
@@ -1209,6 +1209,7 @@ Usage: chicken FILENAME OPTION ...
   Language options:
 
     -feature SYMBOL              register feature identifier
+    -no-feature SYMBOL           disable built-in feature identifier
 
   Syntax related options:
 
Trap