[m-rev.] diff: .NET back-end: work-around "2>&1"
Fergus Henderson
fjh at cs.mu.OZ.AU
Sun Feb 16 15:14:56 AEDT 2003
This patch is a hack... however, it does get things working, and it is
conditionalized on .NET. So I'm going to go ahead and commit it.
With this patch, and the others that I've posted recently, the `il'
grade compiler builds all of the stage2 library. The generated il files
show only minor differences from the stage1 library il files.
One of the differences is due to a minor bug in the C back-end --
it gets a small rounding error in the last decimal place of one of
the generated floating point constants. This is due to flaws in the
underlying C library implementation.
The other differences look like they are all due to the different
representation of `char' on the .NET back-end. I think there may be
issues with cross-compiling to a grade with a different character
representation.
The bootstrap still dies when it gets to the stage2 compiler,
because the build scripts pass `-I ../library' whereas the `il' grade
mercury_compile.exe expects DOS-style path names, i.e. `-I ..\library'.
This is essentially the same problem that affects the Mingw port.
But we're definitely getting close now :-)
----------
Estimated hours taken: 1
Branches: main
compiler/passes_aux.m:
Add a work-around for a bug where it was passing Unix-style file
redirection ("... > file 2>&1") to io__call_system_return_signal,
which doesn't work with the .NET back-end.
Workspace: /home/fjh/ws/hermes
Index: compiler/passes_aux.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/passes_aux.m,v
retrieving revision 1.52
diff -u -d -r1.52 passes_aux.m
--- compiler/passes_aux.m 16 Feb 2003 02:16:36 -0000 1.52
+++ compiler/passes_aux.m 16 Feb 2003 03:45:58 -0000
@@ -523,9 +523,15 @@
% and error streams.
%
io__make_temp(TmpFile),
- io__call_system_return_signal(
- string__append_list([Command, " > ", TmpFile, " 2>&1"]),
- Result),
+ { use_dotnet ->
+ % XXX can't use Bourne shell syntax to redirect on .NET
+ % XXX the output will go to the wrong place!
+ CommandRedirected = Command
+ ;
+ CommandRedirected =
+ string__append_list([Command, " > ", TmpFile, " 2>&1"])
+ },
+ io__call_system_return_signal(CommandRedirected, Result),
(
{ Result = ok(exited(Status)) },
maybe_write_string(PrintCommand, "% done.\n"),
@@ -631,6 +637,17 @@
;
String = String0
).
+
+ % Are we compiling in a .NET environment?
+:- pred use_dotnet is semidet.
+:- pragma foreign_proc("C#",
+ use_dotnet,
+ [will_not_call_mercury, promise_pure, thread_safe],
+"
+ SUCCESS_INDICATOR = true;
+").
+% The following clause is only used if there is no matching foreign_proc.
+use_dotnet :- semidet_fail.
% Are we compiling in a win32 environment?
%
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list