From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sjoerd van Leent Newsgroups: gmane.lisp.guile.devel Subject: Discussion for %display-auto-compilation-messages (and --no-auto-compilation-messages option) Date: Sat, 01 Mar 2014 23:08:06 +0100 Message-ID: <53125A46.3010407@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000403040507050600020400" X-Trace: ger.gmane.org 1393711487 15804 80.91.229.3 (1 Mar 2014 22:04:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Mar 2014 22:04:47 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Mar 01 23:04:56 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WJs1f-0003Oq-GP for guile-devel@m.gmane.org; Sat, 01 Mar 2014 23:04:55 +0100 Original-Received: from localhost ([::1]:60984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJs1f-0002co-28 for guile-devel@m.gmane.org; Sat, 01 Mar 2014 17:04:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJs1S-0002Vb-4h for guile-devel@gnu.org; Sat, 01 Mar 2014 17:04:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJs1E-00017f-OQ for guile-devel@gnu.org; Sat, 01 Mar 2014 17:04:42 -0500 Original-Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:38425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJs1E-00017Y-E4 for guile-devel@gnu.org; Sat, 01 Mar 2014 17:04:28 -0500 Original-Received: by mail-wi0-f182.google.com with SMTP id f8so1863840wiw.3 for ; Sat, 01 Mar 2014 14:04:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=RA72yisHi4sNwGjsws2IntMCx4DpstsDSukMnBtCoto=; b=K0JM1wBjmHmQ5imPquuZZpHNzWbqFMnUXs+RKWJZbKiMuzvtIbfdUN53d8/Ibr82JC L5oGxGMCHbMDI2V8IT3HklijpZqm0BD3p66YJNoTM0F9ErKcx6pcuz1o8wzVXJ3MIxEr sP/qU9KRroA98ibUSaxQBHH1YwmYt9D0OR+k9OClmQyXMPbvi6IyE0fN6UDXLS3yqAi/ 86ilUplQooa1tOkXoPjmVE/pZR2KiCVTqz7URrsZaHWO/AL1+yvO4eMAl/wdjqbwfbn2 yvCwZGJQtpztWkl6giWO5vRtOdrKHcRssxX1uPsy1UA788DWfe8899I9Fh7SSAjLS0Fa 8HsA== X-Received: by 10.180.9.51 with SMTP id w19mr8074672wia.27.1393711466867; Sat, 01 Mar 2014 14:04:26 -0800 (PST) Original-Received: from [192.168.1.47] (195-240-99-3.ip.telfort.nl. [195.240.99.3]) by mx.google.com with ESMTPSA id u6sm18905812wif.6.2014.03.01.14.04.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 01 Mar 2014 14:04:26 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.3.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::236 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16938 Archived-At: This is a multi-part message in MIME format. --------------000403040507050600020400 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I have been having a bit of a go at understanding boot-9.scm. While investigating it, i found out an interesting bit where SCM code is compiled to new .GO code when performing fresh-compilation. I found similar code in the C sources in load.c. Now I wanted to add an option to disable the display of the compilation messages so went ahead with creating such an option. However, before I continue, I want a discussion about two things: - Shouldn't it be that either the C code or the SCM is responsible for displaying the messages? If so, I would assume the C code should be changed to have formal procedures to handle these things. - Also, is this option in general wanted? If this is the case, I would also like to clean up the above mess of having two procedures printing exactly the same kind of information, leading to maintenance issues. I attached a simple diff file, so everyone could have their opinions shared. --------------000403040507050600020400 Content-Type: text/x-patch; name="discussion.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="discussion.patch" diff --git a/libguile/load.c b/libguile/load.c index 5019201..48f7443 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -228,6 +228,9 @@ static SCM *scm_loc_fresh_auto_compile; /* The fallback path for auto-compilation */ static SCM *scm_loc_compile_fallback_path; +/* Whether or not to display messages for auto-compilation */ +static SCM *scm_loc_display_auto_compilation_messages; + /* Ellipsis: "..." */ static SCM scm_ellipsis; @@ -763,9 +766,12 @@ do_try_auto_compile (void *data) SCM source = SCM_PACK_POINTER (data); SCM comp_mod, compile_file; - scm_puts_unlocked (";;; compiling ", scm_current_error_port ()); - scm_display (source, scm_current_error_port ()); - scm_newline (scm_current_error_port ()); + if (scm_is_true (*scm_loc_display_auto_compilation_messages)) + { + scm_puts_unlocked (";;; compiling ", scm_current_error_port ()); + scm_display (source, scm_current_error_port ()); + scm_newline (scm_current_error_port ()); + } comp_mod = scm_c_resolve_module ("system base compile"); compile_file = scm_module_variable (comp_mod, sym_compile_file); @@ -792,9 +798,12 @@ do_try_auto_compile (void *data) /* Assume `*current-warning-prefix*' has an appropriate value. */ res = scm_call_n (scm_variable_ref (compile_file), args, 5); - scm_puts_unlocked (";;; compiled ", scm_current_error_port ()); - scm_display (res, scm_current_error_port ()); - scm_newline (scm_current_error_port ()); + if (scm_is_true (*scm_loc_display_auto_compilation_messages)) + { + scm_puts_unlocked (";;; compiled ", scm_current_error_port ()); + scm_display (res, scm_current_error_port ()); + scm_newline (scm_current_error_port ()); + } return res; } else @@ -840,6 +849,13 @@ SCM_DEFINE (scm_sys_warn_auto_compilation_enabled, "%warn-auto-compilation-enabl #define FUNC_NAME s_scm_sys_warn_auto_compilation_enabled { static int message_shown = 0; + + if (scm_is_false (*scm_loc_display_auto_compilation_messages)) + { + /* If auto-compilation messages are not to be shown, this should be set + to disable further display of this message */ + message_shown = 1; + } if (!message_shown) { @@ -1136,6 +1152,8 @@ scm_init_load () = SCM_VARIABLE_LOC (scm_c_define ("%load-should-auto-compile", SCM_BOOL_F)); scm_loc_fresh_auto_compile = SCM_VARIABLE_LOC (scm_c_define ("%fresh-auto-compile", SCM_BOOL_F)); + scm_loc_display_auto_compilation_messages + = SCM_VARIABLE_LOC (scm_c_define ("%display-auto-compilation-messages", SCM_BOOL_T)); scm_ellipsis = scm_from_latin1_string ("..."); diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index cac058c..5789db0 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -4091,18 +4091,27 @@ when none is available, reading FILE-NAME with READER." (if (and gostat (more-recent? gostat scmstat)) go-file-name (begin - (if gostat - (format (current-warning-port) - ";;; note: source file ~a\n;;; newer than compiled ~a\n" - name go-file-name)) - (cond - (%load-should-auto-compile - (%warn-auto-compilation-enabled) - (format (current-warning-port) ";;; compiling ~a\n" name) - (let ((cfn (compile name))) - (format (current-warning-port) ";;; compiled ~a\n" cfn) - cfn)) - (else #f))))) + (let ((newer-message-note "note: source file") + (newer-than-compiled-message "newer than compiled")) + (if gostat + (if %display-auto-compilation-messages + (format (current-warning-port) + ";;;~a ~a\n;;; ~a ~a\n" + newer-message-note + name + newer-than-compiled-message + go-file-name))) + (cond + (%load-should-auto-compile + (%warn-auto-compilation-enabled) + (if %display-auto-compilation-messages + (begin + (format (current-warning-port) ";;; compiling ~a\n" name))) + (let ((cfn (compile name))) + (if %display-auto-compilation-messages + (format (current-warning-port) ";;; compiled ~a\n" cfn)) + cfn)) + (else #f)))))) #:warning "WARNING: compilation of ~a failed:\n" name)) (define (sans-extension file) diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm index b387eb3..5171ee5 100644 --- a/module/ice-9/command-line.scm +++ b/module/ice-9/command-line.scm @@ -133,6 +133,8 @@ If FILE begins with `-' the -s switch is mandatory. --no-auto-compile disable automatic source file compilation; default is to enable auto-compilation of source files. + --no-auto-compilation-messages disable display of auto-compilation + messages. --listen[=P] listen on a local port or a path for REPL clients; if P is not given, the default is local port 37146 -q inhibit loading of user init file @@ -343,6 +345,10 @@ If FILE begins with `-' the -s switch is mandatory. (set! %load-should-auto-compile #t) (parse args out)) + ((string=? arg "--no-auto-compilation-messages") + (set! %display-auto-compilation-messages #f) + (parse args out)) + ((string=? arg "--fresh-auto-compile") (set! %load-should-auto-compile #t) (set! %fresh-auto-compile #t) --------------000403040507050600020400--