Discussion:
XDS M2 stdin/stdout/stderr redirection problem
(too old to reply)
Martin Brown
2009-09-01 13:20:02 UTC
Permalink
Hi,

I have moved from using JPI M2 to XDS and mostly it is fine. I have just
run into a rather odd problem in XDS with DOS native code (non GUI).

The default channels work fine to the screen and keyboard but the
resulting program ignores DOS redirection and pipes. ie.

Hello.exe >qwerty

Still displays "Hello World" on the screen. And Qwerty has 0 bytes.

And

TestInput.exe <tinput hangs up totally.

tinput contains commands in a valid text file now simplified to the
minimalist:
Quit
^z

Any suggestions how to make it work normally with file redirection >, <
and | or a means to make direct DOSCALLs with this compiler?

Thanks for any enlightenment.

Regards,
Martin Brown
Chris Burrows
2009-09-01 23:39:58 UTC
Permalink
Post by Martin Brown
Any suggestions how to make it work normally with file redirection >, <
The STextIO library calls ("procedures that operate via default input and
output channels") look promising.

e.g. STextIO.WriteString('Hello, World!');

Otherwise somebody on the XDS-x86 forum might be able to help:

http://www.excelsior-usa.com/forum/index.php?board=6.0

--
Chris Burrows
CFB Software
Armaide v2.1: ARM Oberon-07 Development System
http://www.armaide.com
Martin Brown
2009-09-02 08:10:30 UTC
Permalink
Post by Chris Burrows
Post by Martin Brown
Any suggestions how to make it work normally with file redirection >, <
The STextIO library calls ("procedures that operate via default input and
output channels") look promising.
e.g. STextIO.WriteString('Hello, World!');
I know! But unfortunately all the permutations I have tried do the same.
The redirection at DOS command level is stubbornly ignored.

I tried their TS compatible IO, then PIM3 InOut, then STextIO and all do
exactly the same thing. Hardwired to the display and keyboard no matter
what redirection is wrapped around the command line.
Post by Chris Burrows
http://www.excelsior-usa.com/forum/index.php?board=6.0
Thanks. I didn't realise there was any support now.

Regards,
Martin Brown
Fruttenboel
2009-09-02 16:56:33 UTC
Permalink
Post by Martin Brown
I know! But unfortunately all the permutations I have tried do the same.
The redirection at DOS command level is stubbornly ignored.
Have you tried '-' as filename? In many cases, the '-' is a shortcut
for STDIO. This excerpt is from Mocka but FST used a similar approach:

PROCEDURE OpenInput (VAR file : File; VAR name : ARRAY OF CHAR);
VAR s: tFileName;
BEGIN
IF (name[0] = '-') AND ((HIGH (name) = 0) OR (name[1] = CHR(0)))
THEN
file := 0;
ELSE
Strings1.Assign(s,name); (* ms 11/90 *)
file := open (ADR (s), oRDONLY); (* ms 11/90 *)
END;
END OpenInput;
Martin Brown
2009-09-03 06:51:49 UTC
Permalink
Post by Chris Burrows
Post by Martin Brown
Any suggestions how to make it work normally with file redirection >, <
The STextIO library calls ("procedures that operate via default input and
output channels") look promising.
e.g. STextIO.WriteString('Hello, World!');
http://www.excelsior-usa.com/forum/index.php?board=6.0
Problem solved. It wasn't the IO to blame at all, but the TS
compatibility Window MODULE that was usurping all external redirection.
The Window module was still imported by one of the sub units.

I found a post on the Excelsior website compalainign about some aspects
of pipes being a bit iffy, but others did have redirection working so I
had another look for possible causes of this fault.

Regards,
Martin Brown

Fruttenboel
2009-09-02 17:00:28 UTC
Permalink
Post by Martin Brown
Any suggestions how to make it work normally with file redirection >, <
and | or a means to make direct DOSCALLs with this compiler?
XDS is famous for the 'h2def' utillity. It can transform and C .h file
into a Modula-2 Definition Module.

And you can produce a foreign module like in
http://fruttenboel.verhoeven272.nl/mocka/svgalib.html or something
similar. A foreign module uses the DEF file to index into a
precompiled object file.
Loading...