comp.lang.ada
 help / color / mirror / Atom feed
* file to printer (spooling)
@ 2000-03-23  0:00 Peter Hermann
  2000-03-23  0:00 ` John J Cupak Jr
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Peter Hermann @ 2000-03-23  0:00 UTC (permalink / raw)


we need help:
(First of all, our primary goal is portability)
We create, write (several ada.text_io.put_line),
and close a text file.
Thereafter we want to spool that file to the printer 
in order to let it print asynchronously.
How should we do this from within the Ada program?
We do need that action from within the running Ada program.

Do we need an implementation dependent operating system command call?
If yes, what is the name of that call?

-- 
Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
http://www.csv.ica.uni-stuttgart.de/homes/ph/
Team Ada: "C'mon people let the world begin" (Paul McCartney)




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: file to printer (spooling)
  2000-03-23  0:00 file to printer (spooling) Peter Hermann
@ 2000-03-23  0:00 ` John J Cupak Jr
  2000-03-23  0:00   ` Robert Dewar
  2000-03-23  0:00   ` Larry Kilgallen
  2000-03-23  0:00 ` Pascal MALAISE
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 8+ messages in thread
From: John J Cupak Jr @ 2000-03-23  0:00 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 2056 bytes --]

Peter,

I've been able to "automagically" spool a file to the printer when closing
on a DEC(Compaq?) VAX using the FORM string when the file is opened:

with Text_IO;

   procedure Print_Me is

   -- This procedure illustrates how to use the VAX/VMS Ada FORM
   -- parameter in a file create statement. The form string is
   -- written in DEC/VAX FDL, and specifies the creation of an
   -- output file which is printed and deleted upon close. It is
   -- used the same as entering "PRINT/DELETE FILENAME" from DCL.

      Printer : Text_IO.File_Type;                      -- File "Handle"

   begin -- Print_Me

      Text_IO.Create(File => Printer,                   -- Internal file
handle
                     Mode => Text_IO.Out_File,          -- Output file type
                     Name => "PRINT.OUT",               -- Name of external
file
                     Form => "FILE;"                  & -- FORM string; file
type
                     "PRINT_ON_CLOSE  YES;"           & -- Print it
                     "DELETE_ON_CLOSE YES;");           -- Discard afterwards


      Text_IO.Put_Line(Printer,
                       "And away-y-y we go-o-o-o-!");   -- What's printed

      Text_IO.Close(Printer);                           -- Now do
"PRINT/DELETE FILE.OUT"

   end Print_Me;

Peter Hermann wrote:

> we need help:
> (First of all, our primary goal is portability)
> We create, write (several ada.text_io.put_line),
> and close a text file.
> Thereafter we want to spool that file to the printer
> in order to let it print asynchronously.
> How should we do this from within the Ada program?
> We do need that action from within the running Ada program.
>
> Do we need an implementation dependent operating system command call?
> If yes, what is the name of that call?
>
> --
> Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
> Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
> http://www.csv.ica.uni-stuttgart.de/homes/ph/
> Team Ada: "C'mon people let the world begin" (Paul McCartney)

[-- Attachment #2: Card for John J Cupak Jr --]
[-- Type: text/x-vcard, Size: 364 bytes --]

begin:vcard 
n:Cupak Jr;John J
tel;fax:978.858.4336
tel;work:978.858.1222
x-mozilla-html:TRUE
org:Raytheon Company;Northeast Software Training
version:2.1
email;internet:John_J_Cupak@res.raytheon.com
title:Software Engineering Instructor
adr;quoted-printable:;;50 Apple Hill Road=0D=0AT3MN35;Tewksbury;MA;01876;USA
x-mozilla-cpt:;9904
fn:John J Cupak Jr
end:vcard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: file to printer (spooling)
  2000-03-23  0:00 ` John J Cupak Jr
@ 2000-03-23  0:00   ` Robert Dewar
  2000-03-23  0:00   ` Larry Kilgallen
  1 sibling, 0 replies; 8+ messages in thread
From: Robert Dewar @ 2000-03-23  0:00 UTC (permalink / raw)


In article <38DA51C3.A9A4C592@res.raytheon.com>,
  John J Cupak Jr <John_J_Cupak@res.raytheon.com> wrote:
> This is a multi-part message in MIME format.
> --------------FA170147285727830E2956B3
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Peter,
>
> I've been able to "automagically" spool a file to the printer
when closing
> on a DEC(Compaq?) VAX using the FORM string when the file is
opened:


Note that this is not part of Ada (83 or 95), it is an
implementation dependent feature, which as far as I know
is not duplicated in any modern Ada compiler. Well I guess
that's not quite right, GNAT on VMS will in fact allow you
to use the old DEC I/O libraries with all their form params
etc :-)


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: file to printer (spooling)
  2000-03-23  0:00 file to printer (spooling) Peter Hermann
  2000-03-23  0:00 ` John J Cupak Jr
  2000-03-23  0:00 ` Pascal MALAISE
@ 2000-03-23  0:00 ` Larry Kilgallen
  2000-03-23  0:00   ` Tucker Taft
  2000-03-24  0:00 ` Tarjei T. Jensen
  3 siblings, 1 reply; 8+ messages in thread
From: Larry Kilgallen @ 2000-03-23  0:00 UTC (permalink / raw)


In article <8bddei$gmg$1@infosun2.rus.uni-stuttgart.de>, Peter Hermann <ica2ph@iris16.csv.ica.uni-stuttgart.de> writes:
> we need help:
> (First of all, our primary goal is portability)
> We create, write (several ada.text_io.put_line),
> and close a text file.
> Thereafter we want to spool that file to the printer 
> in order to let it print asynchronously.
> How should we do this from within the Ada program?
> We do need that action from within the running Ada program.
> 
> Do we need an implementation dependent operating system command call?
> If yes, what is the name of that call?

If the call is implementation dependent, then clearly the name varies !

SPOOL stands for "Simultaneous Peripheral Operation On-Line",
and originated when jobs ran from card decks.  Not all jobs had
the printer at the same time, but they cannot tell the difference.

If you want your Ada code to be portable, I would suggest putting
the system specific pieces outside the Ada code.  You need to
set up the environment so the file name used would go to the
spooled device.  On VMS this would be done with a logical name.
I presume on Unix it would be done with an "environment variable"
(whatever that is:-).  I know that MVS supports spooling, but I
do not know how you associate a particular program with a spooled
printer device (aside from Batch, where it would certainly be
declared in your JCL).  Certainly AS400 would have such support,
but no Ada compiler so it is not an issue :-).  Others in this
group will tell you about Microsoft and Unix.

Setting up which printers have spooling support is a necessary
system management step, just as is setting up which printers
have print queues associated with them.  Generally speaking,
to get spooling support you will be using print queues, and
even the Macintosh has that.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: file to printer (spooling)
  2000-03-23  0:00 ` John J Cupak Jr
  2000-03-23  0:00   ` Robert Dewar
@ 2000-03-23  0:00   ` Larry Kilgallen
  1 sibling, 0 replies; 8+ messages in thread
From: Larry Kilgallen @ 2000-03-23  0:00 UTC (permalink / raw)


In article <38DA51C3.A9A4C592@res.raytheon.com>, John J Cupak Jr <John_J_Cupak@res.raytheon.com> writes:

> I've been able to "automagically" spool a file to the printer when closing
> on a DEC(Compaq?) VAX using the FORM string when the file is opened:

Yes, certainly that causes the output to go to the printer, but
it is a print job submission done by RMS and does not make use
of the VMS spooling capability.  It probably does not meet the
portability goal, since other systems do not have RMS.  Actually
to meet the portability goal I think he might be better off using
the general spooling capability, but that is for him to decide.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: file to printer (spooling)
  2000-03-23  0:00 ` Larry Kilgallen
@ 2000-03-23  0:00   ` Tucker Taft
  0 siblings, 0 replies; 8+ messages in thread
From: Tucker Taft @ 2000-03-23  0:00 UTC (permalink / raw)


Larry Kilgallen wrote:
> 
> In article <8bddei$gmg$1@infosun2.rus.uni-stuttgart.de>, Peter Hermann <ica2ph@iris16.csv.ica.uni-stuttgart.de> writes:
> > we need help:
> > (First of all, our primary goal is portability)
> > We create, write (several ada.text_io.put_line),
> > and close a text file.
> > Thereafter we want to spool that file to the printer
> > in order to let it print asynchronously.
> > How should we do this from within the Ada program?
> > We do need that action from within the running Ada program.
> >
> > Do we need an implementation dependent operating system command call?
> > If yes, what is the name of that call?

> ... Others in this
> group will tell you about Microsoft and Unix.

I would think in most environments where there is a C library around,
importing the "system" routine, and passing it a string like
"lpr myfile.txt" would accomplish the job.  Whether it is "lpr"
or "print" or whatever would vary from one O/S to the next, so
that part of the string should clearly be reconfigurable.

E.g.:

    procedure Print_File(Printer_Program_Name : String; File_Name : String) is
         procedure System_Command(X : String);
         pragma Import(C, System_Command, "system");
    begin
         System_Command(Printer_Program_Name & " " & File_Name);
    end Print_File;

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: file to printer (spooling)
  2000-03-23  0:00 file to printer (spooling) Peter Hermann
  2000-03-23  0:00 ` John J Cupak Jr
@ 2000-03-23  0:00 ` Pascal MALAISE
  2000-03-23  0:00 ` Larry Kilgallen
  2000-03-24  0:00 ` Tarjei T. Jensen
  3 siblings, 0 replies; 8+ messages in thread
From: Pascal MALAISE @ 2000-03-23  0:00 UTC (permalink / raw)


Peter Hermann wrote:
> 
> we need help:
> (First of all, our primary goal is portability)
> We create, write (several ada.text_io.put_line),
> and close a text file.
> Thereafter we want to spool that file to the printer
> in order to let it print asynchronously.
> How should we do this from within the Ada program?
> We do need that action from within the running Ada program.

Do you mean that the printing request has to be performed IN the
ada program or BY the ada program?

In the second alternative, you can assume that the (compiler/OS)
specific
ada runtime allows you to start another program. This procedure can be
encapsulted in a "to_port" package.
In the ada program: SYS_CALLS.CALL_SYSTEM(PRINTER_COMMAND & " " &
FILE_NAME);

PRINTER_COMMAND is shell script on UNIX, a command file on VMS, or a
batch file on DOS)
and submits the printing.

On unix the script is only "lpr $*"

-- 
Pascal MALAISE
(priv) mailto:malaise@magic.fr
(prof) mailto:malaise@fr.airsysatm.thomson-csf.com




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: file to printer (spooling)
  2000-03-23  0:00 file to printer (spooling) Peter Hermann
                   ` (2 preceding siblings ...)
  2000-03-23  0:00 ` Larry Kilgallen
@ 2000-03-24  0:00 ` Tarjei T. Jensen
  3 siblings, 0 replies; 8+ messages in thread
From: Tarjei T. Jensen @ 2000-03-24  0:00 UTC (permalink / raw)



Peter Hermann wrote in message <8bddei$gmg$1@infosun2.rus.uni-stuttgart.de>...
>we need help:
>(First of all, our primary goal is portability)
>We create, write (several ada.text_io.put_line),
>and close a text file.
>Thereafter we want to spool that file to the printer
>in order to let it print asynchronously.
>How should we do this from within the Ada program?
>We do need that action from within the running Ada program.
>
>Do we need an implementation dependent operating system command call?
>If yes, what is the name of that call?


You should implement the print command either as a configurable string in your
application or as a external script file.

E.g. in Unix/linux there is two ways to print a file. E.g. lp or lpr. In
additon you have to be careful about deleting the file because the print system
might not copy the file to be printed and only use a symbolic link to it. So if
you print and then delete, you might end up deleting the file before it is
printed.


Greetings,







^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-03-24  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-23  0:00 file to printer (spooling) Peter Hermann
2000-03-23  0:00 ` John J Cupak Jr
2000-03-23  0:00   ` Robert Dewar
2000-03-23  0:00   ` Larry Kilgallen
2000-03-23  0:00 ` Pascal MALAISE
2000-03-23  0:00 ` Larry Kilgallen
2000-03-23  0:00   ` Tucker Taft
2000-03-24  0:00 ` Tarjei T. Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox