guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Per-port read options, reader directives, SRFI-105


From: Ludovic Courtès
Subject: Re: [PATCH] Per-port read options, reader directives, SRFI-105
Date: Fri, 26 Oct 2012 19:41:11 +0200
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Hello!

I like this version better, perhaps because it doesn’t prominently
shifts and offsets.  ;-)

Feel free to apply after the cosmetic changes below.

Mark H Weaver <address@hidden> skribis:

> From 77834798bb67076ff6c7a3fd939b2bb55353faff Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <address@hidden>
> Date: Tue, 23 Oct 2012 17:28:43 -0400
> Subject: [PATCH 1/3] Implement per-port read options.
>
> * libguile/read.c (scm_t_read_opts): Update comment to mention the
>   per-port read options.
>
>   (sym_port_read_options): New symbol.

“New variable.”

>   (set_port_read_option): New function.
>
>   (init_read_options): Add new 'port' parameter, and consult the
>   per-port read option overrides when initializing the 'scm_t_read_opts'
>   struct.  Move to bottom of file.
>
>   (scm_read): Pass 'port' parameter to init_read_options.

[...]

>  /* 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. */
> +   from the global and per-port read options, and a pointer is passed
> +   down to all helper functions. */
>  enum t_keyword_style {

Brace on the next line.

> @@ -1970,6 +1943,114 @@ SCM_DEFINE (scm_file_encoding, "file-encoding", 1, 0, 
> 0,
>  }
>  #undef FUNC_NAME
>  
> +/* Per-port read options.

A page break just above would be welcome.

> +   We store per-port read options in the 'port-read-options' key of the
> +   port's alist, which is stored in 'scm_i_port_weak_hash'.  The value
> +   stored in the alist is a single integer that contains a two-bit field
> +   for each read option.
> +
> +   If a bit field contains READ_OPTION_INHERIT (3), that indicates that
> +   the applicable value should be inherited from the corresponding
> +   global real option.  Otherwise, the bit field contains the value of
> +   the read option.  For boolean read options that have been set
> +   per-port, the possible values are 0 or 1.  If the 'keyword_style'
> +   read option has been set per-port, its possible values are those in
> +   'enum t_keyword_style'. */

Nice.

> +SCM_SYMBOL (sym_port_read_options, "port-read-options");

Please add a comment above saying “Key to read options in per-port
alists.”

Thanks!

Ludo’.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]