Mark H Weaver <m...@netris.org> skribis: > From ebe455148c2cc2c8c0511a206cde0b9928fdad89 Mon Sep 17 00:00:00 2001 > From: Mark H Weaver <m...@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’.