From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Per-port read options, reader directives, SRFI-105 Date: Tue, 23 Oct 2012 22:53:29 +0200 Message-ID: <876260c3li.fsf@gnu.org> References: <87a9vmvh9s.fsf@tines.lan> <87mwzdzpqf.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1351025709 13997 80.91.229.3 (23 Oct 2012 20:55:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Oct 2012 20:55:09 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Oct 23 22:55:17 2012 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 1TQlVH-0006pF-OH for guile-devel@m.gmane.org; Tue, 23 Oct 2012 22:55:11 +0200 Original-Received: from localhost ([::1]:50031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQlVA-0003I9-2p for guile-devel@m.gmane.org; Tue, 23 Oct 2012 16:55:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQlV7-0003Hv-5F for guile-devel@gnu.org; Tue, 23 Oct 2012 16:55:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQlV6-0007z1-3J for guile-devel@gnu.org; Tue, 23 Oct 2012 16:55:01 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:46098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQlV5-0007yx-St for guile-devel@gnu.org; Tue, 23 Oct 2012 16:55:00 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TQlVA-0006gy-9k for guile-devel@gnu.org; Tue, 23 Oct 2012 22:55:04 +0200 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Oct 2012 22:55:04 +0200 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Oct 2012 22:55:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 81 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 2 Brumaire an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:Fe+0CtfFzWP641RLI8bwlPXAOFs= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:15031 Archived-At: Mark H Weaver skribis: > From ebe455148c2cc2c8c0511a206cde0b9928fdad89 Mon Sep 17 00:00:00 2001 > From: Mark H Weaver > Date: Tue, 23 Oct 2012 01:10:28 -0400 > Subject: [PATCH 3/9] Change reader to pass read options to helpers via > explicit parameter. Overall good for me. Mostly stylistic remarks, below. > * libguile/read.c (scm_t_read_opts): New internal C struct type. > (init_read_options): New internal static function. “New type” and “New function” is enough. > (CHAR_IS_DELIMITER): Look up square-brackets option via local 'opts'. > Previously the global read option was consulted directly. Second sentence can be removed. > (scm_read): Call 'init_read_options' to initialize a local struct of > type 'scm_t_read_opts'. A pointer to this struct is passed down to > all reader helper functions that need it. “Call ‘init_read_options’.” is enough. > +/* > + * Internal read options structure. This is initialized by 'scm_read' > + * from the global read options, and a pointer is passed down to all > + * helper functions. > + */ Can you use GNU-style comments, without trailing stars, and without start or end markers on a line of their own? > +typedef struct { > + enum { KEYWORD_STYLE_HASH_PREFIX, > + KEYWORD_STYLE_PREFIX, > + KEYWORD_STYLE_POSTFIX } keyword_style; > + char copy_source_p; > + char record_positions_p; > + char case_insensitive_p; > + char r6rs_escapes_p; > + char square_brackets_p; > + char hungry_eol_escapes_p; > +} scm_t_read_opts; Ouch. :-) Can you define all three types separately, and perhaps with a bit-field, like: enum t keyword_style { ... }; struct t_read_opts { enum t_keyword_style style; unsigned int copy_source_p: 1; ... }; typedef struct t_read_opts scm_t_read_opts; > +/* Initialize the internal read options structure > + from the global read options. */ s/the internal .*$/OPTS/ > + RESOLVE_BOOLEAN_OPTION(COPY_SOURCE_P, copy_source_p); Space before ‘(’. > +static SCM scm_read_commented_expression (scm_t_wchar, SCM, scm_t_read_opts *); > +static SCM scm_read_shebang (scm_t_wchar, SCM, scm_t_read_opts *); Can you make it ‘const scm_t_read_opts *’ everywhere? Thanks! Ludo’.