From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: [PATCH] Per-port read options, reader directives, SRFI-105
Date: Tue, 23 Oct 2012 22:53:29 +0200 [thread overview]
Message-ID: <876260c3li.fsf@gnu.org> (raw)
In-Reply-To: 87mwzdzpqf.fsf@tines.lan
Mark H Weaver <mhw@netris.org> skribis:
> From ebe455148c2cc2c8c0511a206cde0b9928fdad89 Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <mhw@netris.org>
> 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’.
next prev parent reply other threads:[~2012-10-23 20:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 10:32 [PATCH] Per-port read options, reader directives, SRFI-105 Mark H Weaver
2012-10-23 6:06 ` Mark H Weaver
2012-10-23 20:44 ` Ludovic Courtès
2012-10-23 20:45 ` Ludovic Courtès
2012-10-23 20:53 ` Ludovic Courtès [this message]
2012-10-23 20:54 ` Ludovic Courtès
2012-10-23 20:57 ` Ludovic Courtès
2012-10-23 20:58 ` Ludovic Courtès
2012-10-23 21:26 ` Ludovic Courtès
2012-10-24 4:04 ` Mark H Weaver
2012-10-24 13:13 ` Ludovic Courtès
2012-10-24 14:41 ` Mark H Weaver
2012-10-26 17:30 ` Ludovic Courtès
2012-10-23 21:30 ` Ludovic Courtès
2012-10-24 19:00 ` Mark H Weaver
2012-10-24 21:52 ` David A. Wheeler
2012-10-26 17:41 ` Ludovic Courtès
2012-10-26 17:44 ` Ludovic Courtès
2012-10-26 21:21 ` Ludovic Courtès
2012-10-27 1:33 ` Mark H Weaver
2012-10-29 11:14 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=876260c3li.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).