[comp.lang.modula2] Input /Output

hofstede@.cs.utwente.nl (Jaap Hofstede) (03/11/91)

We use Modula-2 as language in an introductory course in programming.
For IO we don't like the standard InOut because it is impossible to
read (write) more than one file at the same time and we don't like
the File IO module of the compiler we use (TopSpeed), because of the
functions used for reading. Is there a more or less 'standard' module
with IO procedures such as those of InOut, but with an extra file
parameter?

Jaap Hofstede                               (hofstede@cs.utwente.nl)
Dept. of Computer Science (INF/SPA)
University of Twente
Enschede, Netherlands

S.J.Lovatt@massey.ac.nz (S.J. Lovatt) (03/12/91)

From: hofstede@.cs.utwente.nl (Jaap Hofstede)
>
> We use Modula-2 as language in an introductory course in programming.
> For IO we don't like the standard InOut because it is impossible to
> read (write) more than one file at the same time and we don't like
> the File IO module of the compiler we use (TopSpeed), because of the
> functions used for reading. Is there a more or less 'standard' module
> with IO procedures such as those of InOut, but with an extra file
> parameter?
>
> Jaap Hofstede                               (hofstede@cs.utwente.nl)
> Dept. of Computer Science (INF/SPA)
> University of Twente
> Enschede, Netherlands

I assume that you don't like the non-standard TopSpeed procedure names.

When I am not happy with the names of library functions and procedures, I
use the (non-standard) TopSpeed aliasing mechanism, viz:

WriteString ::= WrStr;

... which allows the same parameter sequence as WrStr, but with a
different name. Much of InOut is actually implemented this way, with its
procedures aliased to IO (if I recall correctly). If you have the library
sources, you could probably just copy InOut (to FileInOut, say) and
replace all references to IO with FIO. That ought to do most of what you
seem to want. I haven't tried this, as I have had little cause to use any
of the 'core' library modules. The TopSpeed procedure names save typing,
and are not much more cryptic, so I stick with them.

Please correct me if I mis-understand your problem.

- Simon


-- 
Simon Lovatt            | S.J.Lovatt@massey.ac.nz |
Dept of Biotechnology   |                         |
Massey University, N.Z. |                         |

Frank.Warren@f42.n161.z1.fidonet.org (Frank Warren) (03/19/91)

    I have for some time been working on a library for the Stony Brook 
compiler which will start with JPI functionality and move up from there.
    My complaint with the JPI library is the lack of locking for multi-
process things, lack of flexibility in the windowing system and so on.
   If you're ultimately interested in something like this, I'll be making it 
available via Stony Brook.  Incidentally, if you try Stony Brook I thin 
you'll find it a superior programming environment, especially for those 
trying to learn the language and not the in's and out's of DOS.

--  
uucp: uunet!m2xenix!puddle!161!42!Frank.Warren
Internet: Frank.Warren@f42.n161.z1.fidonet.org

icsu7039@attila.cs.montana.edu (Spannring) (03/20/91)

   What I might suggest is to write your own file i/o routines.  That
would also solve one of my pet peeves about Modula-2 which is the
fact that nobody I've asked seems to know how InOut should be
implemented.  The differences between how the FST compiler and the Stony
Brook compiler handle ReadString (and other routines) are slight, but
infuriating.  The one we have on our Un*x box doesn't even have InOut.

--
====================================================================
 Six of one, 110 (base 2) of       | Craig Spannring
 another.                          | icsu7039@caesar.cs.montana.edu
 ----------------------------------+--------------------------------