[m-dev.] diff: Fix a couple of bugs in Morphine-collect.
Erwan Jahier
Erwan.Jahier at irisa.fr
Wed Aug 16 20:00:36 AEST 2000
| On 16-Aug-2000, Erwan Jahier <Erwan.Jahier at irisa.fr> wrote:
| > Fix a couple of bugs in Morphine-collect.
| >
| > extras/morphine/source/collect.in:
| > Import the `int' module as it is needed by the integer
| > event attributes.
| ...
| > -:- import_module int, io, std_util.
| > +:- import_module list, int, io, std_util.
|
| Actually the log message here was wrong, the change is to import the
| `list' module. But the change is fine.
oops.
| > extras/morphine/source/collect.op:
| > Add a #1 directive so that the error message eventually produced
| > during the compilation of collect.m indicates a line number
| > that makes sense.
|
| It would be a good idea to also add a `:- pragma source_file' declaration
| immediately before the `#1' directive. Otherwise the error messages
| will indicate the right line, but the wrong file, which may be quite
| confusing...
That's a very good idea, thanks.
--
extras/morphine/source/collect.op:
Index: 2.12/source/collect.op
--- 2.12/source/collect.op Wed, 16 Aug 2000 11:30:13 +0200 jahier (opium/d/7_collect.op 1.9 640)
+++ 2.12(w)/source/collect.op Wed, 16 Aug 2000 11:52:28 +0200 jahier (opium/d/7_collect.op 1.9 640)
@@ -316,9 +316,17 @@
write(collect, ":- mode acc_in :: in.\n"),
write(collect, ":- mode acc_out :: out.\n\n")
),
- % #1 is a directive to mmc so that mmc believes that the first line
- % begins here. This is to have more sensible line numbers if the
- % compilation of collect.m fails for some reasons.
+
+
+ % From the Mercury Reference manual:
+ % The `source_file' pragma and `#line' directives provide
+ % support for preprocessors and other tools that generate
+ % Mercury code. The tool can insert these directives into the
+ % generated Mercury code to allow the Mercury compiler to
+ % report diagnostics (error and warning messages) at the
+ % original source code location, rather than at the location in
+ % the automatically generated Mercury code.
+ printf(collect, ":- pragma source_file(\"%w\").\n", [File]),
write(collect, "#1\n"),
write(collect, Body),
close(collect),
--
R1.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list