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

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Apr 28 00:01:29 AEST 2010


On Tue, 27 Apr 2010, Julien Fischer wrote:

>
> On Tue, 27 Apr 2010, Ralph Becket wrote:
>
>> Julien Fischer, Friday, 23 April 2010:
>>> 
>>> 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.)
>
> That looks okay -- I still think it would be better to handle this with
> the rest of the stdlib initialisation, but that can be a separate
> change.  (The same, w.r.t to thread to the formatter map.)

Actually, there was one problem with that diff, the the names of the
global variable in C were not prefixed with ML_.

I have committed the following patch which fixes that.

Julien.

-------


library/pretty_printer.m:
 	Prefix exported symbols with ML_.

Index: library/pretty_printer.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/pretty_printer.m,v
retrieving revision 1.10
diff -u -r1.10 pretty_printer.m
--- library/pretty_printer.m	27 Apr 2010 06:02:14 -0000	1.10
+++ library/pretty_printer.m	27 Apr 2010 13:29:42 -0000
@@ -903,13 +903,13 @@
      %
  :- pragma foreign_decl("C",
  "
-    extern MR_Bool pretty_printer_is_initialised;
-    extern MR_Word pretty_printer_default_formatter_map;
+    extern MR_Bool ML_pretty_printer_is_initialised;
+    extern MR_Word ML_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;
+    MR_Bool ML_pretty_printer_is_initialised = MR_FALSE;
+    MR_Word ML_pretty_printer_default_formatter_map = NULL;
  ").

  :- pragma foreign_decl("Java",
@@ -932,7 +932,7 @@
          pretty_printer_is_initialised(Okay::out, _IO0::di, _IO::uo),
          [promise_pure, will_not_call_mercury, thread_safe],
  "
-    Okay = pretty_printer_is_initialised;
+    Okay = ML_pretty_printer_is_initialised;
  ").

  :- pragma foreign_proc("Java",
@@ -968,7 +968,7 @@
          unsafe_get_default_formatter_map(FMap::out, _IO0::di, _IO::uo),
          [promise_pure, will_not_call_mercury, thread_safe],
  "
-    FMap = pretty_printer_default_formatter_map;
+    FMap = ML_pretty_printer_default_formatter_map;
  ").

  :- pragma foreign_proc("Java",
@@ -1009,8 +1009,8 @@
          set_default_formatter_map(FMap::in, _IO0::di, _IO::uo),
          [promise_pure, will_not_call_mercury],
  "
-    pretty_printer_default_formatter_map = FMap;
-    pretty_printer_is_initialised = MR_TRUE;
+    ML_pretty_printer_default_formatter_map = FMap;
+    ML_pretty_printer_is_initialised = MR_TRUE;
  ").

  :- pragma foreign_proc("Java",
--------------------------------------------------------------------------
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