comp.lang.ada
 help / color / mirror / Atom feed
* Re: How to bypass CTRL-C?
  1999-01-27  0:00 How to bypass CTRL-C? psx2
@ 1999-01-27  0:00 ` Larry Kilgallen
  1999-01-28  0:00 ` robert_dewar
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Larry Kilgallen @ 1999-01-27  0:00 UTC (permalink / raw)


In article <36AF61EE.93C36E67@videotron.com>, psx2@videotron.com writes:
> The topic says it all.
> How can I block the CTRL-C keys so that the 
> program can not terminate that way.

The title of the newsgroup says it all.  This newsgroup is about Ada,
on all operating systems (or without operating systems).

The question you pose has nothing to do with Ada, as it is specific
to particular operating systems (those for which CTRL/C has a
reserved meaning), and should be discussed in the newsgroup
for whatever operating system you are using.

Larry Kilgallen




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

* How to bypass CTRL-C?
@ 1999-01-27  0:00 psx2
  1999-01-27  0:00 ` Larry Kilgallen
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: psx2 @ 1999-01-27  0:00 UTC (permalink / raw)


The topic says it all.
How can I block the CTRL-C keys so that the 
program can not terminate that way.

Thanks.




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

* Re: How to bypass CTRL-C?
  1999-01-27  0:00 How to bypass CTRL-C? psx2
                   ` (2 preceding siblings ...)
  1999-01-28  0:00 ` Geert Bosch
@ 1999-01-28  0:00 ` bourguet
  3 siblings, 0 replies; 6+ messages in thread
From: bourguet @ 1999-01-28  0:00 UTC (permalink / raw)


In article <36AF61EE.93C36E67@videotron.com>,
  psx2@videotron.ca wrote:
> The topic says it all.
> How can I block the CTRL-C keys so that the
> program can not terminate that way.
>
> Thanks.
>

Depending on your compiler and OS, CTRL-C may be interpreted as an interuption
for which you may attach an handler. (With GNAT 3.10p, you could not attach
handler to this interrupt, GNAT 3.11p has a provision for it but I've no
tried yet).

Yours,

-- Jean-Marc

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: How to bypass CTRL-C?
  1999-01-27  0:00 How to bypass CTRL-C? psx2
  1999-01-27  0:00 ` Larry Kilgallen
@ 1999-01-28  0:00 ` robert_dewar
  1999-01-28  0:00 ` Geert Bosch
  1999-01-28  0:00 ` bourguet
  3 siblings, 0 replies; 6+ messages in thread
From: robert_dewar @ 1999-01-28  0:00 UTC (permalink / raw)


In article <36AF61EE.93C36E67@videotron.com>,
  psx2@videotron.ca wrote:
> The topic says it all.
> How can I block the CTRL-C keys so that the
> program can not terminate that way.


This is of course highly implementation dependent. You
should look at your compiler documentation. If you search
for Ctrl-C in the secret GNAT archives (namely the GNAT
Reference manual :-) you will find a paragraph on the
Unreserve_All_Interrupts pragma, which is specifically
there to let a programmer handle the Ctrl-C (and possibly
other similar) interrupts.

So this completely solves the problem with GNAT. If you are
using some other compiler, go look in their documentation
and hopefully you will find they have done something
similar. If not, you will be on your own and have to do
non-Ada fiddling.

Documentation is useful stuff, try it some time :-)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: How to bypass CTRL-C?
  1999-01-27  0:00 How to bypass CTRL-C? psx2
  1999-01-27  0:00 ` Larry Kilgallen
  1999-01-28  0:00 ` robert_dewar
@ 1999-01-28  0:00 ` Geert Bosch
  1999-01-28  0:00 ` bourguet
  3 siblings, 0 replies; 6+ messages in thread
From: Geert Bosch @ 1999-01-28  0:00 UTC (permalink / raw)


This issue is partly compiler/platform specific. If you're 
using GNAT, be sure to browse the documentation and have
a look at the "features" file for things new in GNAT 3.11p:

|  A new pragma Unreserve_All_Interrupts allows an implementation to
|  specify that normally reserved interrupts (e.g. SIGINT for handling
|  Ctrl-C) are to be unreserved, so that the application program may
|  handle these interrupts as it pleases.

In your case this pragma alone would be enough, as you do not actually
want to handle the interrupt but only want to prevent the system from
handling it for you. So you do not have to install a handler, although
you might want to do so for printing an error message 
  (like "*** program cannot be interrupted ***")
or to register the request and terminate as soon as possible.

Note that the mechanisms to actually install handlers for interrupts
is part of the language and support for interrupts is provided by
all compilers implementing Annex C (Systems Programming).

Regards,
   Geert




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

* Re: How to bypass CTRL-C?
@ 1999-01-28  0:00 John Herro
  0 siblings, 0 replies; 6+ messages in thread
From: John Herro @ 1999-01-28  0:00 UTC (permalink / raw)



psx2@videotron.ca wrote:
> How can I block the CTRL-C keys so that the
> program can not terminate that way.

If you're using DOS with an Ada compiler that lets you call the DOS interrupts,
call interrupt 16#21#, function 16#07#.  This will put the character in AL
without echoing it, and without allowing Ctrl-C to break.  Separately echo the
character if you want.

If you're using DOS with the Open Ada compiler, there's a simpler solution:
with Tty;
...
  C : Character;
...
  C := Tty.Get(Direct => True);

- John Herro
You can download a shareware AdaTutor program at
http://members.aol.com/AdaTutor. 




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

end of thread, other threads:[~1999-01-28  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-27  0:00 How to bypass CTRL-C? psx2
1999-01-27  0:00 ` Larry Kilgallen
1999-01-28  0:00 ` robert_dewar
1999-01-28  0:00 ` Geert Bosch
1999-01-28  0:00 ` bourguet
  -- strict thread matches above, loose matches on Subject: below --
1999-01-28  0:00 John Herro

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