[m-rev.] For review: ensure proper initialisation of pretty_printer

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Apr 23 16:44:14 AEST 2010


On Fri, 23 Apr 2010, Ralph Becket wrote:

> Okay, here's an interdiff:
>
> diff -u library/pretty_printer.m library/pretty_printer.m
> --- library/pretty_printer.m	22 Apr 2010 05:39:14 -0000
> +++ library/pretty_printer.m	23 Apr 2010 02:17:15 -0000
> @@ -884,11 +884,13 @@
> %-----------------------------------------------------------------------------%
> % Convenience predicates.
>
> -:- mutable(io_formatter_map, formatter_map, new_formatter_map, ground,
> -    [attach_to_io_state, untrailed, thread_local]).
> -
> +    % This is where we keep the display parameters (line width etc.).
> +    % The formatter map is handled separately because it *has* to
> +    % be initialised immediately (i.e., before any other module's
> +    % initialisation directive can update the default formatter map).
> +    %
> :- mutable(io_pp_params, pp_params, pp_params(78, 100, triangular(100)),
> -    ground, [attach_to_io_state, untrailed, thread_local]).
> +    ground, [attach_to_io_state, untrailed]).
>
> %-----------------------------------------------------------------------------%
>
> @@ -901,8 +903,13 @@
>     %
> :- pragma foreign_decl("C",
> "
> -    static MR_Bool pretty_printer_is_initialised = MR_FALSE;
> -    static MR_Word pretty_printer_default_formatter_map = NULL;
> +    extern MR_Bool pretty_printer_is_initialised;
> +    extern MR_Word pretty_printer_default_formatter_map;
> +").
> +:- pragma foreign_code("C",
> +"
> +    MR_Bool pretty_printer_is_initialised = MR_FALSE;
> +    MR_Word pretty_printer_default_formatter_map = NULL;
> ").

You will also need to provide Erlang and Java implementations (or at the
very least add Mercury definitions for the new foriegn_procs you have
added, so that the java and erlang grades still compile.)

Julien
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list