From 0e2e403666b922b4dd609d7e5969437e03c5ba94 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Tue, 11 Oct 2016 22:30:11 +0200 Subject: [PATCH 4/9] 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. --- library.scm | 2 +- runtime.c | 18 +++--------------- setup-api.scm | 8 ++++---- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/library.scm b/library.scm index c3e1dce..decde2a 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 cc7ba6f..36f3819 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 0eed0a5..5d009eb 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 -- 2.1.4