From: Luka Djigas on
This is purely a theoretical issue for me, not a practical one, but I'm interested in it, for
curiosity's sake.

Imagine a modern workplace ... pc, win/linux (whatever fits you the most), modern printer and so on.

Nowadays, when we use output units we usually mean either output to file (number), or to screen
(usually * for default output unit).

How would one go about printing directly to printer ? On a modern compiler (whichever one you like),
how can one determine what units represent what output devices ?
I tried searching a little through help in intel's and gfortran's which I have available, but I'm
not sure what exactly am I really looking for.

Kind regards to all,
Luka
From: glen herrmannsfeldt on
Luka Djigas <ldigas@___gmail___.com> wrote:

> This is purely a theoretical issue for me, not a practical one,
> but I'm interested in it, for curiosity's sake.

> Imagine a modern workplace ... pc, win/linux (whatever fits
> you the most), modern printer and so on.

> Nowadays, when we use output units we usually mean either output
> to file (number), or to screen (usually * for default output unit).

> How would one go about printing directly to printer?

These days, and actually for many years now, no-one prints
directly to a printer. Instead you write a disk file and then
spool that to a printer. There are systems that automate the
process of adding the queue entry (along with a famous TOPS-10 bug).

With C on systems with popen(), you can pipe directly to
the spooler, which is sometimes convenient. It would be nice
to have something like popen() for Fortran.

-- glen
From: Luka Djigas on
On Mon, 29 Mar 2010 22:50:28 +0000 (UTC), glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:

>Luka Djigas <ldigas@___gmail___.com> wrote:
>
>These days, and actually for many years now, no-one prints
>directly to a printer. Instead you write a disk file and then
>spool that to a printer. There are systems that automate the
>process of adding the queue entry (along with a famous TOPS-10 bug).

Of course. This is, as I mentioned, a purely curiosity issue in view of practicality.

But for the sake of argument let's say that I have an epson matrix printer (I do actually) sitting
idleless connected to my computer (it does actually :) How would I / and can it be done anymore / go
about printing to it directly from a program ?
Or are those times long gone now, and apart from accessing to files and the display, unit
numbers are more of a history curiosity ? Are they used for something except the mentioned ?
(not necessarily only on personal computers ...)

with regards,
Luka

>
>With C on systems with popen(), you can pipe directly to
>the spooler, which is sometimes convenient. It would be nice
>to have something like popen() for Fortran.
>
>-- glen
From: Richard Maine on
Luka Djigas <ldigas@___gmail___.com> wrote:

> On Mon, 29 Mar 2010 22:50:28 +0000 (UTC), glen herrmannsfeldt
<gah(a)ugcs.caltech.edu> wrote:
>
> >Luka Djigas <ldigas@___gmail___.com> wrote:
> >
> >These days, and actually for many years now, no-one prints
> >directly to a printer. Instead you write a disk file and then
> >spool that to a printer. There are systems that automate the
> >process of adding the queue entry (along with a famous TOPS-10 bug).
>
> Of course. This is, as I mentioned, a purely curiosity issue in view of
practicality.
>
> But for the sake of argument let's say that I have an epson matrix printer
> (I do actually) sitting idleless connected to my computer (it does
> actually :) How would I / and can it be done anymore / go about printing
> to it directly from a program ?

You wouldn't. The operating system probably won't let you. If you knew
how to convince the operating system to let you directly access it, then
you'd probably know the rest of the answer too. :-(

If life is very simple and nice, you just might possibly get the
operating system to give you access to a "node" that you can write to as
though it were a file. If that's the case, open the node (somewhere in
/dev if you are on a unix-like system) and go for it. You might want to
use unformatted stream output for maximal control of every bit written,
though you might get by with less. That isn't literally writing directly
to the printer, but it is as close as you are going to have any chance
of getting. There is still an operating system driver taking what you
write to the "node" and sending it out the port.

If you really, really want to write directly to the printer, then dig
out the hardware manuals for the I/O port. You won't do it with anything
related to Fortran I/O (or C either). You'd be doing something more like
manipulating registers in the I/O controller. Maybe you could get the
registers memory mapped to Fortran variables... maybe.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
From: glen herrmannsfeldt on
Luka Djigas <ldigas@___gmail___.com> wrote:
(snip)

> But for the sake of argument let's say that I have an epson
> matrix printer (I do actually) sitting idleless connected to
> my computer (it does actually :) How would I / and can it be done
> anymore / go about printing to it directly from a program ?

It isn't easy. With a protected mode OS (for most, that means
anything since MS-DOS) you can't do directly to the I/O port.

> Or are those times long gone now, and apart from accessing to
> files and the display, unit numbers are more of a history
> curiosity ? Are they used for something except the mentioned ?
> (not necessarily only on personal computers ...)

It might be that in some cases you can directly open LPT1
or COM1 and write directly (thought OS device drivers) to
the device. Many printers accept the usual ASCII control
characters, such as CR, LF, and FF. I believe that is
usual for EPSON printers.

As Richard mentioned PostScript, which does things completely
different. Postscript printers expect everything to be
commands, with the show command to actually print text
on a page, and the showpage command to actually print
it on paper.

-- glen