~ chicken-core (chicken-5) 066b6b261c222cb38240cffbbf9b203ab7bd4087


commit 066b6b261c222cb38240cffbbf9b203ab7bd4087
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Tue Oct 11 22:30:11 2016 +0200
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Fri Oct 28 12:27:58 2016 +1300

    Use C_gui_mode directly; remove OS-specific fudges
    
    Only fudge 4 was used by core at all.  These are all quite weird; in
    fact, fudge factor 5 even has a comment indicating its silliness.
    
    Signed-off-by: Evan Hanson <evhan@foldling.org>

diff --git a/library.scm b/library.scm
index c3e1dce6..decde2ae 100644
--- a/library.scm
+++ b/library.scm
@@ -4579,7 +4579,7 @@ EOF
    (let ([string-append string-append])
      (lambda (msg . args)
        (##sys#error-handler (lambda args (##core#inline "C_halt" "error in error")))
-       (cond ((##sys#fudge 4)
+       (cond ((not (foreign-value "C_gui_mode" bool))
 	      (##sys#print "\nError" #f ##sys#standard-error)
 	      (when msg
 		(##sys#print ": " #f ##sys#standard-error)
diff --git a/runtime.c b/runtime.c
index cc7ba6fd..36f3819d 100644
--- a/runtime.c
+++ b/runtime.c
@@ -4842,18 +4842,10 @@ C_regparm C_word C_fcall C_fudge(C_word fudge_factor)
     panic(C_text("(##sys#fudge 3) [64bit] is obsolete"));
 
   case C_fix(4):		/* is this a console application? */
-    return C_mk_bool(!C_gui_mode);
+    panic(C_text("(##sys#fudge 4) [console application] is obsolete"));
 
   case C_fix(5):		/* is this a GUI/console or Windows-GUI application? (silly) */
-    if(C_gui_mode) {
-#ifdef _WIN32
-      return C_fix(1);
-#else
-      return C_SCHEME_FALSE;
-#endif
-    }
-
-    return C_fix(0);
+    panic(C_text("(##sys#fudge 5) [Windows GUI application] is obsolete"));
 
   case C_fix(6): 		/* milliseconds CPU */
     panic(C_text("(##sys#fudge 6) [current CPU milliseconds] not implemented"));
@@ -4871,11 +4863,7 @@ C_regparm C_word C_fcall C_fudge(C_word fudge_factor)
     return C_fix(CLOCKS_PER_SEC);
 
   case C_fix(11):		/* not a unix system? */
-#if defined(C_NONUNIX) || defined(__CYGWIN__)
-    return C_SCHEME_FALSE;
-#else
-    return C_SCHEME_TRUE;
-#endif
+    panic(C_text("(##sys#fudge 11) [UNIX system] is obsolete"));
 
   case C_fix(12):		/* tty forced? */
     return C_mk_bool(fake_tty_flag);
diff --git a/setup-api.scm b/setup-api.scm
index 0eed0a59..5d009eb0 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -704,12 +704,12 @@ C_confirmation_dialog(char *msg, char *caption, int def, int abort) { return -1;
 ;;       unless that requires linking any libraries. This would also
 ;;       be useful for runtime error messages.
 
-(define-foreign-variable C_HAS_MESSAGE_BOX bool)
-
 (define yes-or-no?
-  (let ((dialog (foreign-lambda int "C_confirmation_dialog" c-string c-string int bool)))
+  (let ((dialog (foreign-lambda int "C_confirmation_dialog" c-string c-string int bool))
+	(C_HAS_MESSAGE_BOX (foreign-value "C_HAS_MESSAGE_BOX" bool))
+	(C_gui_mode (foreign-value "C_gui_mode" bool)))
     (lambda (str #!key default title (abort reset))
-      (let ((gui (and C_HAS_MESSAGE_BOX (not (##sys#fudge 4))))) ; C_gui_mode
+      (let ((gui (and C_HAS_MESSAGE_BOX C_gui_mode)))
 	(define (get-input)
 	  (if gui
 	      (let ((r (dialog
Trap